.net - Is it possible to enable relationship fixup when change tracking is disabled but proxies are generated -


i have entities form tree relationships.

class myentity {     public int id {get;set;}      public int parentid {get;set;}     public virtual myentity parent {get;set;}      public virtual icollection<myentity> children {get;set;} } 

when these entities called without asnotracking() relationships fixed up.

var entities = myentitiesset.tolist(); 

all navigation properties , collections set.
if asnotracking() called:

var entities = myentitiesset.asnotracking.tolist(); 

no navigation property set. understandable. cannot understand why collection , naviagtion properties not overriden provide relationship fixup code:

entity.parent = anotherentity; 

here expect anotherentity.children collection contains entity. alas, false expectation experimetns show.

is possible desired behavior without enabling change tracking?

update 1

i loked @ generated proxies , noted overriden collections hashsets of proxy type. not backed entitycollection<tentity> true ef 4 objectcontext proxies.

and i've found answer here.
dbcontext not generate proxies fix relationships.

dbcontext does not generate proxies fix relationships.

proof here: http://connect.microsoft.com/visualstudio/feedback/details/760609/poco-navigation-proxies-should-fixup-the-other-end-automatically

yet, when entitties attached context loading related entities:

context.aset.tolist(); context.bset.tolist(); 

sets relationships automatically.


Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -