Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I am using the ADO .NET Entity Framework to import my model from a database. A table in my db has a bunch of foreign keys, all with abstract names e.g. FKDevice132610.

When I import the table into my model, it brings in navigation properties for each foreign key, however they are imported with names based on the table name they link to. If there is more than one foreign key to a certain table, a number is appended on the end.

Ef model

In this case Devices1 is ParentDevices and Devices2 is ChildDevices. Is there a way I can enter this information into my foreign key (say using the description or the name) so that the Entity Framework will import meaningful names for my navigation properties?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
276 views
Welcome To Ask or Share your Answers For Others

1 Answer

As I know there is currently no way to do that. This is how current designer works. What is even worse when you rename these properties to correct names updating model from database will sometimes overwrite your changes.

Improvement of navigation property naming is tracked by this work item - http://entityframework.codeplex.com/workitem/125


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...