Castle ActiveRecord 属性乐观锁定
Castle ActiveRecord 可以对属性进行乐观锁定吗?我发现乐观锁定适用于整个类,但不适用于单个属性。就我而言,我需要这样做,以便在集合中添加/删除元素不会更新实体的版本号(例如,将 Product
添加到 Store
code> 而不更改任何 Store
的属性不会增加版本号)。
Can Castle ActiveRecord do optimistic locking on properties? I found optimistic locking for the entire class, but not for an individual property. In my case, I need to make it so that adding/removing elements in a collection does not update the version number of the entity (so for example, adding a Product
to a Store
without changing any of Store
's properties will not increment the version number).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
NHibernate 支持
optimistic-lock
属性,该属性可应用于属性或集合,并且在设置为 false 时完全按照您的意愿执行(默认为 true) )我认为 ActiveRecord 目前没有公开它。不知道延长它会有多难。
NHibernate supports an
optimistic-lock
property that can be applied to properties or collections and does exactly what you want when set to false (default is true)I think ActiveRecord doesn't currently expose it. Not sure how hard it would be to extend it.