David
David

Reputation: 1841

NHibernate saving implicitly?

I'm experiencing some odd behaviour with NHibernate and I don't know if maybe I'm just misunderstanding how sessions and transactions work.

The behaviour is I'm openening a Session, starting a transaction for that session. I then retrieve a collection of objects using the session, manipulate the objects in some way then Commit the transaction. At no point in this process am I calling Save or Update on the session but it is implicitly saving the state of the objects within the session.

Is this appropriate behaviour? I'm using a wrapper for my sessions which is why it always opens and commits the transactions.

Upvotes: 0

Views: 193

Answers (1)

Kleber Bernardo
Kleber Bernardo

Reputation: 193

Take a look on the Flush, FlushMode and IsDirty. This is common when you manipulate collections.

if you change the items in a collection or change the pointer from one collection to the new collection is Nhibernate scans through IsDirty at the time of the flush.

Upvotes: 2

Related Questions