You'll want to take a look at the event listeners then. NH doesn't rule everything, it simply coordinates database operations, so you don't have too. if the state of the domain changes, Nh will propagate those changes for you. If you want to modify the state of the domain without modifying the database I would suggest mapping the data from the NH scoped domain objects to non-nh-managed objects. you can then work with this set of objects without NH automatically persisting the changes.
On Dec 10, 8:40 am, Jacob Madsen <ja...@mungo.dk> wrote: > Im working with a framework, where NHibernate is not king and ruling > everything. So this developer would be very happy if NH could be so kind ;-) > > We have different kind of interceptors, where it would be really nice and > handy if NH could expose this knowledge, so we could invoke a specific kind > of interceptors. The NH built-in interceptor wont do it. > > On Fri, Dec 10, 2010 at 2:32 PM, Jason Meckley <jasonmeck...@gmail.com>wrote: > > > these are lower level concerns within NH that a developers shouldn't > > need to think about. the session itself implements an identity map > > which is responsible for ensuring exactly 1 instance of an entity > > exists per session. > > > Get() and Load() use the identity map to determine if the entity is > > already loaded so you don't query the database twice. a query will > > retrieve the entity from the database, but if the entity is already > > loaded in the session that instance will be returned instead of the > > results from the database. for example > > > //table Entity > > //columns Id int, Name varchar > > //row 1, "old name" > > > var entity = session.Get<Entity>(1); > > // result from database is row [1, "old name"] > > // entity[1] loaded into session's identity map (IM) > > > entity.Name = "new name"; > > // entity[1] in IM Name property is changed > > > var entity = session > > .CreateQuery("from Entity where id = :id") > > .SetParameter("id", 1) > > .Unique<Entity>(); > > // result from database is row [1, "old name"] > > // entity[1] already exists in the IM as Entity{Id = 1, Name = "new > > name"} > > > Assert.That(entity.Name, Is.EqualTo("new name")); > > // should pass > > > Hopefully that clears things up. > > > On Dec 10, 7:55 am, Jacob Madsen <ja...@mungo.dk> wrote: > > > Hi there, > > > > Hope one of you can help me with 2 questions: > > > > 1) How do I ask a session if a specific entity is dirty / has changed? > > > > 2) Will ISession.Contains(entity) return true for any session-tracked > > > entity, no matter how the entity was loaded / queried / retrieved? > > > -- > > You received this message because you are subscribed to the Google Groups > > "nhusers" group. > > To post to this group, send email to nhus...@googlegroups.com. > > To unsubscribe from this group, send email to > > nhusers+unsubscr...@googlegroups.com<nhusers%2bunsubscr...@googlegroups.com> > > . > > For more options, visit this group at > >http://groups.google.com/group/nhusers?hl=en. > > -- You received this message because you are subscribed to the Google Groups "nhusers" group. To post to this group, send email to nhus...@googlegroups.com. To unsubscribe from this group, send email to nhusers+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/nhusers?hl=en.