The EntitySet is already loaded and the source cannot be
The EntitySet is already loaded and the source cannot be
Hi,
I get an exception when trying to re-attach entities to a context.
"The EntitySet is already loaded and the source cannot be changed."
I'm trying to figure out under what circumstances this message will be fired?
I get an exception when trying to re-attach entities to a context.
"The EntitySet is already loaded and the source cannot be changed."
I'm trying to figure out under what circumstances this message will be fired?
Call Stack
We're also seeing this behavior since latest release, here's the callstack that blows up after a call to:
Code: Select all
DataContext.GetTable().Attach(OurUpdatedObjectFromTheSameContext, true);
Code: Select all
[InvalidOperationException: The EntitySet is already loaded and the source cannot be changed.]
System.Data.Linq.EntitySet`1.SetSource(IEnumerable`1 entitySource) +807755
Devart.Data.Linq.Mapping.EntitySetDefSourceAccessor`2.a(T& A_0, IEnumerable`1 A_1) +104
System.Data.Linq.Mapping.MetaAccessor`2.SetBoxedValue(Object& instance, Object value) +84
Devart.Data.Linq.Provider.d.SetLinks(TEntity obj, Object keySource, IList`1 linkMembers, EntityCache`2 cache, f services, IList`1 queryLoadWith, Dictionary`2 nextLoadWiths) +1154
[TargetInvocationException: Exception has been thrown by the target of an invocation.]
System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner) +0
System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner) +71
System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks) +261
System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) +29
Devart.Data.Linq.Table`1.a(TEntity A_0, TEntity A_1, Boolean A_2) +691
Devart.Data.Linq.Table`1.Attach(TEntity entity, Boolean asModified) +13