Castle ActiveRecord 属性乐观锁定

发布于 2024-08-30 12:46:09 字数 196 浏览 2 评论 0原文

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

惜醉颜 2024-09-06 12:46:09

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文