NHibernate property change tracking
What is the best way to implement property change tracking with NHibernate. I'm migrating an application from LINQ-to-SQL and am currently implementing it in the entity like so.
public class Task {
partial void OnLoaded() {
OriginalTitle = Title;
}
public bool OriginalTitle { get; private set; }
public bool TitleChanged { get { return Title != OriginalTitle; } }
}
However, there is now OnLoaded event method in NHibernate. Is th开发者_JS百科ere a way this code could be auto-generated somehow?
You can try with session event listener: http://nhibernate.info/doc/howto/various/creating-an-audit-log-using-nhibernate-events
精彩评论