Hello,
this is the current config:
ctx.Configuration.ProxyCreationEnabled = false;
// res is the main object = an employee
// res.ARBEITSZEITEN are the list of past and current engagements
res = ctx.RESSOURCEN.Include(z => z.ARBEITSZEITEN).FirstOrDefault(a =>
a.EXTERNE_ID == personalnummer);
// In the case of an error:
foreach (ARBEITSZEITEN a in res.ARBEITSZEITEN)
{
ctx.Entry(a).State = EntityState.Detached;
}
ctx.Entry(res).State = EntityState.Detached;
Stacktrace of the inner exception:
bei System.Data.Entity.Core.Mapping.Update.Internal.UpdateTranslator.Update()
bei
System.Data.Entity.Core.EntityClient.Internal.EntityAdapter.<Update>b__2(UpdateTranslator
ut)
bei System.Data.Entity.Core.EntityClient.Internal.EntityAdapter.Update[T](T
noChangesResult, Func`2 updateFunction)
bei System.Data.Entity.Core.EntityClient.Internal.EntityAdapter.Update()
bei System.Data.Entity.Core.Objects.ObjectContext.<SaveChangesToStore>b__35()
bei
System.Data.Entity.Core.Objects.ObjectContext.ExecuteInTransaction[T](Func`1
func, IDbExecutionStrategy executionStrategy, Boolean startLocalTransaction,
Boolean releaseConnectionOnSuccess)
bei
System.Data.Entity.Core.Objects.ObjectContext.SaveChangesToStore(SaveOptions
options, IDbExecutionStrategy executionStrategy, Boolean startLocalTransaction)
bei
System.Data.Entity.Core.Objects.ObjectContext.<>c__DisplayClass2a.<SaveChangesInternal>b__27()
bei
System.Data.Entity.Infrastructure.DefaultExecutionStrategy.Execute[TResult](Func`1
operation)
bei
System.Data.Entity.Core.Objects.ObjectContext.SaveChangesInternal(SaveOptions
options, Boolean executeInExistingTransaction)
bei System.Data.Entity.Core.Objects.ObjectContext.SaveChanges(SaveOptions
options)
bei System.Data.Entity.Internal.InternalContext.SaveChanges()
Thanks
Niko
-----Ursprüngliche Nachricht-----
Von: Jiří Činčura [mailto:[email protected]]
Gesendet: Dienstag, 1. August 2017 11:52
An: [email protected]
Betreff: Re: [Firebird-net-provider] Handling Errors with EF
> If I want to loop through the navigation property directy (without
> copying it to another List<T>) is there a way to do this? I don#t
> understand the collection changed error, because I do not add or
> remove an item from the list. I am changing the Entitystate.
What's the exception stack trace? That should work out of the box (with the
proxies turned off).
--
Mgr. Jiří Činčura
https://www.tabsoverspaces.com/
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most engaging tech
sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Firebird-net-provider mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/firebird-net-provider
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Firebird-net-provider mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/firebird-net-provider