I'm using the following mapping:
public class LoadMap : IAutoMappingOverride<Load> {
public void Override(AutoMapping<Load> mapping) {
mapping.HasMany(x => x.Bids).OptimisticLock.None();
mapping.Version(x => x.Version);
}
}
But when I try to create the session I get the following exception:
[FormatException: The string 'none' is not a valid Boolean value.]
[XmlSchemaValidationException: The 'optimistic-lock' attribute is invalid - The value 'none' is invalid according to its datatype 'http://www.w3.org/2001/XMLSchema:boolean' - The string 'none' is not a valid Boolean value.]
I'm using NHibernate 2.1.2.4000 and I was using Fluent NHibernate 1.0RTM, but tried the latest build 636 just to be sure this isn't something that was fixed recently or something.
As a side note, in case I'm doing this all wrong, I would like to be able to make changes to the .Bids list without incrementing Version. I saw an example on Ayende's blog that did what I wanted with properties.
I think it's a bug. Valid values for the optimistic-lock property are true|false, as you state in your comment. It appears that Fluent NHibernate is setting the property to none but I would generate the XML schema to be sure.
As Jamie says, looks like a bug (or missing feature) in Fluent NHibernate. I've added a hack to allow setting False and True on OptimisticLock in my github fork. It seems to work.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With