When the save button is clicked, the following code is run [PersistenceSession is a property returning an ISession instance]:
_storedWill = PersistenceSession.Load<StoredWill&g开发者_JAVA技巧t;(_storedWillId);
_storedWill.WillReference = txtWillReference.Text;
_storedWill.IntroducerReference = txtIntroducerReference.Text;
//A stack of other properties of the _storedWill object assigned
PersistenceSession.SaveOrUpdate(_storedWill);
A breakpoint set on the final line reveals that PersistenceSession.IsDirty() is true.
However, no update SQL is generated. Can anyone think why?
Thanks
David
You need to Flush
the session to have the updates sent to the database. SaveOrUpdate
will not send anything to the database unless you are persisting a newly-created entity, whose ID values are database generated. Since you are just updating, all this does is ensures that the _storedWill
entity is associated with the ISession
returned by the PersistenceSession
property.
精彩评论