- edited description
TObjectDataset problem with TBooleanField
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)
-
reporter -
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.
-
repo owner -
assigned issue to
- changed component to Base
-
assigned issue to
-
repo owner - changed milestone to 1.2.2
-
repo owner Ah, I see. Typically Variant -> any compatible type is being handled by the TValue.TryCast method from the RTL and that one does not handle the special case of tkEnumeration being a Boolean. Will report and fix.
Edit: reported as https://quality.embarcadero.com/browse/RSP-20160
-
repo owner - changed status to resolved
fixed
#290→ <<cset 68d77bffa99b>>
-
repo owner Issue
#296was marked as a duplicate of this issue. - Log in to comment