Hi there.
LLBL 3.0.
I'm mapping models to entities via automapper. A complaint I have received is that null values are not being persisted to the database (for an UPDATE scenario). I can see that I need to manually change IsChanged on the field to true when I am setting a value to null.
I can tack on extra instructions to automapper, but when the fields are the same name and same type I don't want to have to create a definition for each field to manage this.
So I came up with this (added to the entity definition).
protected override void OnSetValueComplete(int fieldIndex)
{
if (this.Fields[fieldIndex].CurrentValue == null &&
!this.Fields[fieldIndex].IsChanged)
{
this.Fields.IsDirty = true;
this.Fields[fieldIndex].IsChanged = true;
}
base.OnSetValueComplete(fieldIndex);
}
I was wondering if this would create any issues? I'm using this in a asp.net application, never for windows.