In my nhibenate session I Mapping object with AutoMapper and in the afterMap action i create new instance of the object because I extract the object from the DB for properties compare. So The AutoMapper create two instances of one object with the same ID. When I try to commit the session i get error that i have to object with the same ID.
So I Want to disconnect the object that I extract after the properties compare. After that I will can commit the session
How I do that?
Thanks!
You can use session.Evict(persistentObject)
to evict a persistent object from the session. This will remove the object from the 1st level cache, thus allowing you to flush the session.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With