NHibernate Forge
The official new home for the NHibernate for .NET community

Comments: Finding Dirty Properties in NHibernate

Wiki Page Hierarchy

Pages

Page Details

First published by:
Ricardo Peres
on 10-09-2009
Last revision by:
Ricardo Peres
on 06-20-2011
1 person found this article useful.
Comments (8)
History (7)

Finding Dirty Properties in NHibernate

Sort by: Published Date | Most Recent | Most Useful
1 2 Next >
By: alecava Posted on 11-05-2009 18:17

I've been looking for this feature for a long time. Many many thanks.

By: diegose Posted on 11-11-2009 17:54

This code:

       EntityEntry oldEntry = sessionImpl.PersistenceContext.GetEntry(entity);

       if ((oldEntry == null) && (entity is INHibernateProxy))

       {

           INHibernateProxy proxy = entity as INHibernateProxy;

           Object obj = sessionImpl.PersistenceContext.Unproxy(proxy);

           oldEntry = sessionImpl.PersistenceContext.GetEntry(obj);

       }

Can be simplified as:

       EntityEntry  oldEntry = sessionImpl.PersistenceContext.GetEntry(sessionImpl.PersistenceContext.Unproxy(entity));

By: Stevo Posted on 04-17-2010 7:42

Hello,

today I found this great extension! But it doesn’t work for me... and couldn’t figure it out.

The variable "oldEntry" is null. I’m a total newbie at NHibernate. I use the newest version of HNibernate in my ASP.NET Project.

I use an HttpModule:

       private void context_BeginRequest(object sender, EventArgs e)

       {

           CurrentSessionContext.Bind(SessionProvider.Instance.GetSession());

       }

       private void context_EndRequest(object sender, EventArgs e)

       {

           CurrentSessionContext.Unbind(SessionProvider.Instance.GetSession().SessionFactory);

       }

Maybe this is the problem... thx a lot! Stevo

By: a_rasekh Posted on 09-01-2010 4:03

Hi there,

I load an object in a session, then close the session.

after manipulation object in UI, I want to save it if it is dirty.

but with your method I can't do it.

How I can chek dirty in another session?

By: Eduard Stanculet Posted on 02-18-2011 5:03

I have the same problem with OldEntity is null

I think i am in a different session

Powered by Community Server (Commercial Edition), by Telligent Systems