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).
Asked
Active
Viewed 515 times
0

Daniel T.
- 37,212
- 36
- 139
- 206
1 Answers
0
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.

Diego Mijelshon
- 52,548
- 16
- 116
- 154
-
Thanks. That's pretty disheartening to hear. – Daniel T. Apr 27 '10 at 19:35
-
Well, being open source, it's just a matter of downloading the sources and checking where the mappings are generated. Moving to non-wrapped NHibernate is the next alternative. – Diego Mijelshon Apr 27 '10 at 19:46
-
To confirm Diego's answer: ActiveRecord doesn't currently support the optimistic-lock attribute on properties/collections. It's not hard to implement though, see http://github.com/castleproject/Castle.ActiveRecord/blob/master/src/Castle.ActiveRecord/Framework/Internal/Visitors/XmlGenerationVisitor.cs#L598 – Mauricio Scheffer Apr 28 '10 at 01:33