Skip to content

Better navigation property names when reverse engineering a model #1076

Closed

Description

@rowanmiller

We should just get this right from the start and not generate Order.Customer, Order.Customer1 like we did in past versions.

Some comments from a blog post:

When you start making reverse-engineer tools, please make reference names to classes meaningful.
Example: When you have table Customer that has field KeyAccountManagerId that reference to table Employee, then reference should not be in code Customer.Employee but Customer.KeyAccountManager.
For LinqToSQL and EF6 i have written my on tools to make this possible, because Reference names like Emloyee1, and Employee2 will lead some serious business logic bugs.

Activity

  1. added this to the milestone on Nov 17, 2014
  2. modified the milestones: , 7.0.0 on Nov 25, 2014
  3. lajones commented on Feb 20, 2015

    @lajones
    Contributor

    Part of #830.

  4. lajones commented on Mar 4, 2015

    @lajones
    Contributor

    @rowanmiller #1751 implements this. However although this makes some situations better (e.g. ReportsTo on Employees in Northwind now comes out as a property called ReportsTo instead of Employees1), it also makes some situations worse. For instance in AdventureWorks there are 7 tables whose PK is BusinessEntityID (only 1 of which is actually called BusinessEntity). The foreign keys are also all called BusinessEntityID. Hence all dependent end Nav Props to any of those entity types are all called BusinessEntity (though they have the correct type) where before they would have been called the same as the type they pointed to. Looking to the future inheritance scenarios might be mixed up by this also.

  5. rowanmiller commented on Mar 5, 2015

    @rowanmiller
    ContributorAuthor

    I think that's probably fine, in general the FK names are probably the most likely to be correct (we use FK name right and not PK name).

  6. lajones commented on Mar 5, 2015

    @lajones
    Contributor

    @rowanmiller Correct. FK name, not PK name.

  7. lajones commented on Mar 10, 2015

    @lajones
    Contributor

    Done - with commit d2f7162.

  8. modified the milestones: , 7.0.0 on Mar 23, 2015
  9. modified the milestones: , 1.0.0 on Oct 15, 2022
  10. 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

Labels

No labels
No labels

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions