Do you use serialization?
I forgot about one issue with it. When using serialization to make
clone I always get this when attaching object to new session:
Failed: NHibernate.HibernateException : reassociated object has dirty
collection reference
at NHibernate.Event.Default.OnLockVisitor.ProcessCollection(Object
collection, CollectionType type)
at NHibernate.Event.Default.AbstractVisitor.ProcessValue(Object
value, IType type)
at NHibernate.Event.Default.AbstractVisitor.ProcessValue(Int32 i,
Object[] values, IType[] types)
at
NHibernate.Event.Default.AbstractVisitor.ProcessEntityPropertyValues
(Object[] values, IType[] types)
at NHibernate.Event.Default.AbstractVisitor.Process(Object obj,
IEntityPersister persister)
at
NHibernate.Event.Default.AbstractReassociateEventListener.Reassociate
(AbstractEvent event, Object entity, Object id, IEntityPersister
persister)
at NHibernate.Event.Default.DefaultLockEventListener.OnLock(LockEvent
event)
at NHibernate.Impl.SessionImpl.FireLock(LockEvent lockEvent)
at NHibernate.Impl.SessionImpl.Lock(Object obj, LockMode lockMode)
On 20 июн, 21:20, Frederic <[email protected]> wrote:
> I'm using NH with winforms everyday. And it's easy.
> The reason why you are experiencing issues, it is because you see the
> ORM as a dataset, and you don't realize that your entities is not
> attached to a db context.
>
> As any other object, if you just consider a POCO, what would you do to
> solve your issue ?
>
> If you need to cancel changes, you just need to reload the object from
> the db and evict the object from your session
>
> Your problem is not related to Nh or winforms, webapps or services mays
> "cancel changes" on a loaded entity.
>
> And at least, instrad of cloning, you could use a local binary
> serialisation, to restore a previous state.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"nhusers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nhusers?hl=en
-~----------~----~----~----~------~----~------~--~---