The ConvertEmptyStringToNull setting brought to light the issue of setting any nullable type to null. This only affects setting a nullable property that has a value to actually be null (was 2.00 to null), the field is not marked changed so it is not updated.
The fix is to mark the property being set to null to changed and mark the entity as dirty.
I have updated the attachment in the top message to include the fix, this affects the 1.0 version too, I will be posting an update to that version also.
As for the ConvertEmptyStringToNull to setting. The attachment leaves it off, meaning all "" will be converted to null.
You can override the behaviour by adding an attribute to the property (not easy unless you use LLBLGen 3.0, not sure why this cannot be applied to classes?)
[System.ComponentModel.DataAnnotations.DisplayFormat(ConvertEmptyStringToNull=true)]
Add this to your LLBLGenModelBinder.cs, this will affect all objects bound:
protected override object GetPropertyValue(ControllerContext controllerContext, ModelBindingContext bindingContext, PropertyDescriptor propertyDescriptor, IModelBinder propertyBinder)
{
return propertyBinder.BindModel(controllerContext, bindingContext);
}
I think you could create a new class that inherits from DataAnnotationsModelMetadataProvider or AssociatedMetadataProvider, set ConvertEmptyStringToNull = false in the constructor which would allow properties to override using the attribute. Then set the ModelMetadataProvider.Current to your new provider.
Let me know if you see any issues with this fix.
Brian