代码之家  ›  专栏  ›  技术社区  ›  anonymous

NHibernate:拦截器返回值的含义

  •  7
  • anonymous  · 技术社区  · 16 年前

    我遇到了以下链接中描述的关于生成ID和级联的问题:

    https://www.hibernate.org/hib_docs/nhibernate/html/example-parentchild.html

        public override bool OnLoad(object entity, object id, object[] state, string[] propertyNames, IType[] types)
        {
            if (entity is Persistent) ((Persistent)entity).OnLoad();
            return false;
        }
    
        public override bool OnSave(object entity, object id, object[] state, string[] propertyNames, IType[] types)
        {
            if (entity is Persistent) ((Persistent)entity).OnSave();
            return false;
        }
    

    http://www.lostechies.com/blogs/rhouston/archive/2008/03/27/creating-a-timestamp-interceptor-in-nhibernate.aspx

    2 回复  |  直到 16 年前
        1
  •  5
  •   Steve Willcock    16 年前

        2
  •  0
  •   Diego Magalhães    16 年前

    休伊,

    http://knol.google.com/k/fabio-maulo/nhibernate-chapter-11/1nr4enxv3dpeq/14#

    通常对应用程序有用 对发生的某些事件作出反应 NHibernate内部。这允许 实施某些类型的 通用功能和扩展

    11.1.拦截器IIinterceptor接口提供来自 检查申请和/或 操纵持久化的属性 已删除或加载。一种可能的用途 因为这是为了跟踪审计 在以下情况下设置createTimestamp lastUpdateTimestamp属性 IAuditable已更新。