Skip to content
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

Scaffolding should singularize table names but retain column names exactly #21440

Closed
GSPP opened this issue Jun 28, 2020 · 2 comments
Closed

Comments

@GSPP
Copy link

GSPP commented Jun 28, 2020

Scaffolding should support singularizing table names but retaining column names exactly at the same time. This appears to not be supported at this time. UseDatabaseNames appears to switch off the singularization for tables names (I'm using Bricelam.EntityFrameworkCore.Pluralizer which works great).

I'd like the mapping like this:

table Customers => class Customer
column CustomerID => property CustomerID

When UseDatabaseNames == true, the class ends up named Customers which is undesirable. With UseDatabaseNames == false, the class is named well but ID becomes Id. There are other examples for column names that are undesirable such as "RequestUACPU" becoming "RequestUacpu". UACPU is a name for an HTTP header. It should be cases as specified in the database.

This is a problem for these reasons:

  1. It breaks existing code assuming specific names of database columns. This is particularly relevant for our LINQ 2 SQL migration.
  2. The modified casing for columns leads to undesirable names. For example, Id is the wrong name according to certain naming conventions. On .NET, abbreviations of at most two characters generally are uppercase. "Id" reads like the Latin word "id" (or like "id software"). But the correct pronunciation is I-D.
  3. Names have been defined as desired in the database. There is no need to deviate from that. The developers should have the final say over naming because every project and team are different in their choices.

I realize can I simply rename the property. But we are speaking of about 1000 tables here. Also, I'd like an automated, repeatable process for reverse-engineering so that we can incorporate database changes. Our workflow starts with creating the database schema. The ORM is downstream. Scaffolding must be a simple workflow. Scaffold-DbContext is great for that but the naming needs a little bit more customization.

To summarize, there should be a setting that controls singularization for table names. An independent setting should control how column names are treated.

@ajcvickers
Copy link
Member

Duplicate of #12102

@GSPP
Copy link
Author

GSPP commented Jun 30, 2020

Sorry for creating so much noise. I searched for pre-existing issues but did not find that one.

@ajcvickers ajcvickers reopened this Oct 16, 2022
@ajcvickers ajcvickers closed this as not planned Won't fix, can't repro, duplicate, stale Oct 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants