Entity framework - associations

Discussion of open issues, suggestions and bugs regarding Entity Framework support in ADO.NET Data providers
Post Reply
Sulphy
Posts: 34
Joined: Wed 12 Sep 2012 18:07

Entity framework - associations

Post by Sulphy » Mon 20 Jan 2014 13:46

Hi,

Just got a few questions. I'm upgrading my project (attempt number 4) and wanted to get some clarity on some issues I'm having.

1. I get the below flagged as a warning:
Warning 9 Association 'SERVICE_IMPACTED' is based on a non-nullable property(ies). In case any 'IMPACTED' object is removed from 'SERVICE'.'IMPACTEDs', an exception will be thrown.It is recommended to set the 'Delete On Null' association property to True for this association.


I can set the 'Delete on Null' to true and the error will clear. But I don't really understand what this error is telling me, why i'm getting it and the actual impact of setting 'Delete on Null' to true.


2. Some of my associations tend to drop when I refresh the model. Any clues as to why this happens? Not all of them, just some and without warning.

Thanks in advance!

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

Re: Entity framework - associations

Post by Shalex » Tue 21 Jan 2014 15:30

Sulphy wrote:Warning 9 Association 'SERVICE_IMPACTED' is based on a non-nullable property(ies). In case any 'IMPACTED' object is removed from 'SERVICE'.'IMPACTEDs', an exception will be thrown.It is recommended to set the 'Delete On Null' association property to True for this association.
You are working with LinqConnect, aren't you? Please refer to http://www.devart.com/linqconnect/docs/ ... ities.html > the "Delete on null" section.
Sulphy wrote:Some of my associations tend to drop when I refresh the model. Any clues as to why this happens?
Associations between entities in the model are created/detected basing on the foreign keys in the database.
1. Do the foreign keys (which correspond to the associations being removed) exist in the database?
2. Does Update From Database Wizard offer you to clear the selections of the corresponding FKs on the "Choose change actions" step?

Sulphy
Posts: 34
Joined: Wed 12 Sep 2012 18:07

Re: Entity framework - associations

Post by Sulphy » Wed 22 Jan 2014 08:48

Thanks Shalex,

That makes more sense now. I believe the foreign keys bit rings true so I'll get that sorted in my project :o)

Kind regards,

P

Post Reply