开发者

How NHibernate track changes made to the fields in my entity?

开发者 https://www.devze.com 2023-03-08 04:46 出处:网络
How NHibernate track changes made to the fields in my entity? 开发者_StackOverflow社区If I use second level cache and I change my entity, How does it apply my changes to db?When you change an entity,

How NHibernate track changes made to the fields in my entity? 开发者_StackOverflow社区If I use second level cache and I change my entity, How does it apply my changes to db?


When you change an entity, the entity becomes "dirty" and nhibernate knows the update the entity in your database when the session is flushed. That said, sometimes its possible for entities to get marked dirty even though you have made no change. This results in unnecessary update calls to your database.

It is best to isolate your entities from your views via view models. Once you pull an entity out of the database, convert it to a view model that you can mangle up.

0

精彩评论

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