TObjectDataset problem with TBooleanField

Issue #290 resolved
Ludovic Cléroux created an issue

If I have a model with a published property IsActive : Boolean

The TObjectDataset will create a TBooleanField with FieldName "IsActive"

Then, if I modify the value of the field and post the dataset, the DoPostRecord procedure will be called.

But this part :

if TValue.From<Variant>(fieldValue).TryConvert(prop.PropertyType.Handle, value) then

Will always return false, since it cannot find a suitable converter for a Variant to Boolean data conversion.

The TValueHelper.TryConvert procedure will delegate to TValueConverter.Default.TryConvertTo, for which there will be no suitable converter,

Then, the data post will fail to update the underlying object

Perhaps we should use the TValue.FromVariant instead of TValue.From<Variant> ?

Comments (7)

  1. Stefan Glienke repo owner
    • changed status to open

    Interesting, looks like a bug in the conversions table - Variant holding a Boolean should be convertable to a Boolean and not even look into the value converters.

  2. Log in to comment