This question is locked. New answers and comments are not allowed.
Hello.
Suppose the following code:
I've got the following exception:
Telerik.OpenAccess.Exceptions.InvalidOperationException was unhandled
Message=Object references between two different object scopes are not allowed. The object 'OAEagerLoadingTest.Helper1' is already managed by 'ObjectScopeImpl 0x2' and was tried to be managed again by 'ObjectScopeImpl 0x4'.
Why I'm getting this execption, because the state oh Helper1 entities is DetachedClean?
Or newMain.Helper1 values and newMain.
Thanks in advance.
Suppose the following code:
MainEntity mainE; MainEntity newmainE; using (TestBenchModel model = new TestBenchModel()) { mainE = model.MainEntities.SingleOrDefault(t => t.MainId == 10); newmainE = model.CreateDetachedCopy(mainE, t=>t.Helper1,t=>t.Properties); }newmainE.Value = new Random().Next().ToString(); using (TestBenchModel model = new TestBenchModel()) { MainEntity mainEntity = new MainEntity { Value = "123456" }; foreach (var helper1 in newmainE.Helper1) { mainEntity.Helper1.Add(helper1); } foreach (var prop in newmainE.Properties) { mainEntity.Properties.Add(prop); } model.AttachCopy(mainEntity);I've got the following exception:
Telerik.OpenAccess.Exceptions.InvalidOperationException was unhandled
Message=Object references between two different object scopes are not allowed. The object 'OAEagerLoadingTest.Helper1' is already managed by 'ObjectScopeImpl 0x2' and was tried to be managed again by 'ObjectScopeImpl 0x4'.
Why I'm getting this execption, because the state oh Helper1 entities is DetachedClean?
Or newMain.Helper1 values and newMain.
Properties are linked only to newMain object (belong to newMain object scope???), so I can't use them with other objects?Thanks in advance.