You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add interceptors for model scaffolding/reverse engineering #31060
Not all databases are created with the same semantics. The rules for generating Navigation Names in EFcore appear to be hard coded in method StripId(), and those rules are (1) the field must end in "id" and (2) it may end in "guid" to be a candidate navigation name.
Our UUID/GUID Primary Key fields end in "_uid" which causes the navigation items to end up with a U at the end, such as RoleU. We also store human readable, string based primary keys in fields that end in "_code" so these navigation items would end up as similar to "PersonnelTypeCodeNavigation".
I request adding a (command line) configuration item to be passed in to scaffold generation such that custom suffixes can be defined. In our case this would include "uid" and "code". I would also. request that StripId be refactored or renamed such not all suffixes have to end in "id".
@dpomerantz-jci It should be possible to get any naming you need in the final model by customizing the T4 templates. That being said, an interceptor for handling naming would be useful.
It is possible using the T4 templates, but when it comes to fluent api calls, it gets complex to dig around the code fragment objects trying to find and replace elements. It would be drastically easier to just change the name through configuration or interceptors before it's used for scaffolding.
Activity
ajcvickers commentedon Jun 19, 2023
@dpomerantz-jci It should be possible to get any naming you need in the final model by customizing the T4 templates. That being said, an interceptor for handling naming would be useful.
[-]Navigation Item (Custom) Suffix Removal[/-][+]Add interceptors for model scaffolding/reverse engineering[/+]AceCoderLaura commentedon Jul 31, 2024
It is possible using the T4 templates, but when it comes to fluent api calls, it gets complex to dig around the code fragment objects trying to find and replace elements. It would be drastically easier to just change the name through configuration or interceptors before it's used for scaffolding.