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
Better navigation property names when reverse engineering a model #1076
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.
@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.
Activity
lajones commentedon Feb 20, 2015
Part of #830.
lajones commentedon Mar 4, 2015
@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.
rowanmiller commentedon Mar 5, 2015
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).
lajones commentedon Mar 5, 2015
@rowanmiller Correct. FK name, not PK name.
lajones commentedon Mar 10, 2015
Done - with commit d2f7162.