Skip to content

Add interceptors for model scaffolding/reverse engineering #31060

Description

@dpomerantz-jci

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".

Activity

  1. ajcvickers commented on Jun 19, 2023

    @ajcvickers
    Contributor

    @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.

  2. changed the title [-]Navigation Item (Custom) Suffix Removal[/-] [+]Add interceptors for model scaffolding/reverse engineering[/+] on Jun 19, 2023
  3. added this to the Backlog milestone on Jun 19, 2023
  4. self-assigned this
    on Jun 19, 2023
  5. AceCoderLaura commented on Jul 31, 2024

    @AceCoderLaura

    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.

  6. removed their assignment
    on Aug 31, 2024
  7. added theissue type on Jun 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions