Hello,

 

I am using EF with Firebird for some time now and it works very fine.

 

When I submit a new record via EF i wrap it into a try{} catch{} and want to
to recover in a gentle way. Eg. The new record violates the PK. In this case
I set the current entity to state detached. This works ok unless the entity
has navigation properties that have been populated.

 

this._ctx.Entry(this.NeueBaustelle).State = EntityState.Detached;

 

In this case I tried to detached them before the main entity: 

 

foreach (BAU2ORG bau2org in this.NeueBaustelle.BAU2ORG)
{
         this._ctx.Entry(bau2org).State = EntityState.Detached;
}

 

Unfortunatly I receive a collection has changed error. Therefor I tried
this:

 

this.NeueBaustelle.BAU2ORG.Clear();

 

So far I do not get any troubles (tests are in progress).

 

What is the best way to handle error conditions during save with navigation
properties?

 

Thanks

 

Niko

------------------------------------------------------------------------------
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
Firebird-net-provider@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/firebird-net-provider

Reply via email to