Page 1 of 1

Entity framework - associations

Posted: Mon 20 Jan 2014 13:46
by Sulphy
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!

Re: Entity framework - associations

Posted: Tue 21 Jan 2014 15:30
by Shalex
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?

Re: Entity framework - associations

Posted: Wed 22 Jan 2014 08:48
by Sulphy
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