-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Scaffold-dbcontext: Cannot combine -UseDataBaseNames with pluralizing #12102
Comments
+1 - EF Core Power Tools is also affected by this |
Duplicate of #12007 |
As a work-around, overriding some service will give what is expected. |
This isn't a duplicate of #12007. The casing differences are irrelevant. |
Triage: Even if UseDatabaseNames is used, navigation properties should still be pluralized if the pluzalizer has been configured. DbSet names are more questionable. |
I also experienced this issue. My database has a table named I used a workaround to override |
Is there a solution to this. Would it not be prudent to implement the same logic as in EF6 with DB first. I would assume that 99% of use cases would follow that approach. The challenge here is we can get one thing or the other. Either we have the 'exact' DB names and no pluralization which will also break apps or we have some 'new' approach to converting which follows different logic to what happened in EF 6 DB first. Is there a solution to this one? |
We've got a mountain of tables that could benefit from this. It's one of the major pain points for our .NET 4.6 -> .NET Core 3 migration. I'd be happy to contribute a PR if someone would be able to point me in the right direction of where to start. |
Currently planning LINQ-to-SQL to EF Core migration. The difference in generated names is looking like one of the big pain points. Looking to maintain existing
EDIT: I've just updated to 3.1.0 using EDIT 2: The custom |
Hi @ajcvickers @bricelam, |
@paulovila As the milestone indicates, fixing this issue is currently in the plan for 5.0. |
My DB tables use camel case, where some table names starts with a capitalized acronym (i.e. XYTableName)
scaffold-dbcontext by default generates a DBSet property named XytableName (i. e. the acronym is not capitalized)
I can work around acronym capitalization by adding the "-UseDataBaseNames" switch to scaffold-dbcontext.
This results in a DBSet property named XYTableName (as expected)
But I also want my DBSet properties pluralized.
For this I use "Bricelam.EntityFrameworkCore.Pluralizer" (1.0.0-rc3).
Without -UseDataBaseNames, property names are pluralized as expected (XytableNames)
But with the -UseDatabaseNames switch no pluralizing is performed (XYTableName).
How can I get pluralized DBSet property names AND at the same time keep acronyms from the table name capitalized?
Further technical details
Microsoft.EntityFrameworkCore.Tools (2.1.0-rc1-final)
Database Provider: Microsoft.EntityFrameworkCore.SqlServer (2.0.3)
IDE: Visual Studio 2017 15.7.2
The text was updated successfully, but these errors were encountered: