-
Notifications
You must be signed in to change notification settings - Fork 60
Unable to expose Foreign Key property for associations #55
Comments
No, they're not; that's as-designed. The tool is centered around object modeling, not data modeling. Foreign keys are database concepts rather than object concepts. To access associated objects you access the objects ... the foreign keys are used for persistence only, and violate the concept of "plain old C# objects" since they wouldn't be there if you weren't in a persistence context. EF will use those to support whatever it needs to do its job, and the code generated for the DbContext does indeed specify the keys (since that's where they're important). But not in the entities. |
I understand that they are not auto generated, but it is a pitty that I can not even add them manually in partial class using EF naming convention. For some performance issues we use really often FK to attaching objects. EF designer is really nice tool, and I am personally so sad we can not use it for both object and data modeling. |
I've tagged this as an enhancement request. It's possible that we can set a flag at the designer (and class level, for override) to generate those, but I'll need to look into the implications. |
I'd like to add my +1 to this issue. this enhancement would allow using EFDesigner for very resource hungry use cases. |
This functionality has been there for a while, but the documentation certainly needs updated; just trying to find the time At the model level, selecting the design surface, set Note that this can't be done on a many-to-many association, since those are persisted via a join table. If you want the names of the FK properties to show up on the diagram attached to the association, set the designer's Hope this helps. |
Foreign Key properties are not generated in code.
The text was updated successfully, but these errors were encountered: