在 nhibernate,如果将实体的一个关联属性配置为 lazy="no-proxy",那么,从其他属性计算出来的属性不能正确更新。例如,将以下代码中 Foo.Bar 配置为 lazy="no-proxy" ,属性 c 不能正确持久化。
public class Foo { public virtual Bar Bar { get; set; } public virtual int a { get; set; } public virtual int b { get; set; } public virtual int c { get { return a + b } set { } } } public class Bar { }