简体   繁体   中英

Best practices about navigation properties with Entity Database First

Should I keep all navigation properties that Entity generated or just keep only these I really want ?

For example :

  • I've 2 entities : Location (Id, Code, Name, IdType) and Location type (Id, Code, Name).
  • Entity generates a "Type" property for the entity "Location" and "Locations" property (collection) for the entity "Location type".

If I'd built my model myself, I'd created the first, but probably not the second. So should I keep it or delete it?

Maybe it's like the “Include foreign key column in the model” option. In my opinion, I don't see the utility of this, this even seems to me to be contrary to the development logic. However, I read here that I should let it checked.

Finally I decided to keep them. Like DevilSuichiro said, "more Navigation properties don't hurt". So maybe I'll never use them, but if I have to, I'll be happy not to remove them !

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM