Home > Enterprise >  .Net core CLI DbContext scaffold changed table name to sigular
.Net core CLI DbContext scaffold changed table name to sigular

Time:04-26

For an existing database and with existing code, after upgraded from .Net core 3.x to .Net 5, all mapped classes from below command become singular, e.g. books -> book:

C:\myproject>dotnet ef dbcontext scaffold connectionstr Microsoft.EntityFrameworkCore.SqlServer -f -o ..\Data\Models\ApplicationData

And here is the version info:

C:\myproject>dotnet --version
5.0.303

C:\myproject>dotnet ef --version
Entity Framework Core .NET Command Line Tools
2.0.3-rtm-10026

I also used --use-database-names, seems no effect. Plus, I'm happy with EF generated column names :). But how can I keep the s/ies at the end of the class's name?

Update: I updated the CLI tool by issuing this command:

dotnet tool update --global dotnet-ef --version 5.0

The update was successful. And it's still the same version 2.0.3-rtm-10026. The command list is same too.

TIA

CodePudding user response:

I know this is not the best way but there is a release on its way. I downgraded three EF packages (.design,sqlserver and tools) from 5.0.15 to 3.1.24, and that solved the problem for now.

  • Related