问题
I have Dal classes in my applications, that use database scaffolding for EF database fist. In order to singuarlize / pluralize the tables the right way, I wrote my own custom pluralizer by implementing IPluralizer found in Microsoft.EntityFrameworkCore.Design namespace. This works fine in my .Net Core 2.2 applications.
Since the present release of .Net Core 3.0 I tried to rewrite all my applications. Most of my projects work fine with .Net Core 3.0, but for my Dal projects I'm not able to locate the IPluralizer interface.
How do I use database scaffolding and get the entities pluralized the right way in my .Net Core 3.0 Dal projects?
回答1:
After a little Googling around I stumbled across this article, that describes the problem and how to get it working.
https://docs.microsoft.com/en-us/ef/core/what-is-new/ef-core-3.0/breaking-changes#microsoftentityframeworkcoredesign-is-now-a-developmentdependency-package
Since the Microsoft.EntityFrameworkCore.Design namespace has changed to an Development Dependency Package, you have to modify your project file (.csproj) and comment out the section in order to allow compile against the namespace.
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="3.0.0">
<PrivateAssets>all</PrivateAssets>
<!--<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>-->
</PackageReference>
来源:https://stackoverflow.com/questions/58276505/ipluralizer-where-to-find