-
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
Identifier generation strategy in reverse engineering #3987
Comments
This is a good question. The identifier generation needs to be revisited. Currently Future we will move (2) the csharpification of identifiers into the code-gen step (i.e. RelationalScaffoldingModelFactory will no longer need to return CSharp-safe identifiers.) We haven't designed code-gen API yet. |
Triage: We should just handle snake case in our CSharpUtilities. @roji do you want to send a PR for this? |
@rowanmiller sure I'll submit a PR soon. |
Note this probably means that single uncapitalized words are uppercased. If so there's no more need to detect C# reserved words and prefix them with underscore, since |
Yay! Then at some point we'll have to start looking at the VB keywords instead! 😏 |
Yup, this was one of the intentions of my comments above. |
@lajones regardless of extension points, we should update EF to handle snake case |
Fix checked in with a065b93. |
See comments in #5360. Need to add " " as a word separator. |
Blocked pending discussion between @divega, @rowanmiller and me to decide final design. |
Had discussion on 5/24/16 with @rowanmiller, @divega, @ajcvickers and @bricelam. Approach will be:
The candidate identifier will then be used to produce the final identifier by a) making sure it's a valid identifier for the output language (currently C#) and b) making sure it doesn't clash with existing identifiers as per normal. |
Fix (as designed above) checked in with f2f90ca. |
I can see logic in CSharpUtilities that's responsible for generating a C# identifier out of a database column. In PostgreSQL it seems that the standard case is "snake case" (employee_name). It seems right for the reverse engineering process to convert this to camel case (EmployeeName).
So I was wondering if this is something that Npgsql should do in its own version of CSharpUtilities, or whether the universal CSharpUtilities should detect snake case and perform this task (I'm guessing there are instances where SqlServer or other databases contain snake case).
The text was updated successfully, but these errors were encountered: