开发者

NHibernate property change tracking

开发者 https://www.devze.com 2023-02-06 21:39 出处:网络
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.

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

0

精彩评论

暂无评论...
验证码 换一张
取 消