.net - Why would RelationshipManager.GetRelatedReference(,) always return a EntityReference with null value? -
For some reason, navigation properties are not working on my unit framework model
From the direction N-> 1 , every time I try to get an EntityReference it comes with zero value, even if EntityKey is correct
Direction 1- & Gt; From N , the collection is always empty.
This behavior is in line with my entire model.
Whatever is the reason, I think it should raise the unification of the exception of quietly retrieving an incompatible reference.
What will happen with zero cost due to a possible reference?
edit
I saw something like that with lazy loading. EntityReference (T) Comes on false set with IsLoaded property and resolves the clear call problem of the load method. The problem is that the method
relation manager manager. GetRelatedReference is known by name when Navigation property is accessed, should it load EntityReference it should?
This problem is due to the meaning of LazyLoadingEnabled property.
At first glance, LazyLoadingEnabled = seems to think that the EF will load object releases when the object loads, to prevent EF, certain boundaries have the entire database actually, This means that the relationships will not be loaded ever implications. This is: direction N-> 1 , returned will be from EntityReference (T) to EntityKey but IsLoaded incorrect And value will be zero on the other hand, direction 1-> In N , the collection will be empty, IsLoaded will be incorrect, either EntityReference or EntityCollection to the Load method Can be clearly loaded using.
LazyLoadingEnabled = true, on the other hand, it means that it means
the default is false, the way I started all this confusion did.
To prevent confusion, there must be one attribute called loading mode which will have an enum with meaningful values such as: none , < Code> lazy , eager
Comments
Post a Comment