Associations without keys

Discussion of open issues, suggestions and bugs regarding Entity Framework support in ADO.NET Data providers
Post Reply
mepolsen
Posts: 14
Joined: Mon 25 Oct 2010 19:14

Associations without keys

Post by mepolsen » Tue 02 Apr 2013 18:08

Is it possible to create an association between two entities where no foreighn keys exists in the database. If ca foreign key is needed, can this be restricted to the model only, so as not to modify the database?

Thanks

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: Associations without keys

Post by Shalex » Thu 04 Apr 2013 08:08

Yes, you can create an association in the model without foreign keys in the database in the following alternative ways:
1) turn off the "Model Settings > Synchronization > Mapping > Enable automatic synchronization of storage part and mapping of the model with its conceptual part" option and create an association in CSDL
2) create an association in CSDL (and corresponding constraints in SSDL will be created if the synchronization option is enabled) but do not apply the foreign key changes in the Update Database From Model wizard when using it

Post Reply