fluent-nhibernate icon indicating copy to clipboard operation
fluent-nhibernate copied to clipboard

Property convention does not apply precision

Open kriewall opened this issue 3 years ago • 0 comments

What is the current bug behavior?

I have defined the following property convention with the intent of limiting the precision of all double values to 15 as written to an Oracle dB:

    public class PrecisionConvention : IPropertyConvention
    {
        public void Apply(IPropertyInstance instance)
        {
            if (instance.Type == typeof(double)) instance.Precision(15);
        }
    }

I have a value with exceedingly high precision for a Percentage class being written to the dB. I can see that the precision is being updated for my Percentage class by PrecisionConvention; however, when the value is written to the dB, it is done so at its unmodified precision.

image image

What is the expected correct behavior?

Setting the precision via an implementation of IPropertyConvention should be reflected in the database.

image

Impact

The inability to limit the precision when writing to the dB is causing the Oracle client to bomb out - there's a known issue with Oracle where doubles may be written to the dB in higher precision than can be represented by C# (I reported this issue long ago to them but still have yet to see a fix), so I need a way to limit the precision for all doubles before write. I'd like to request either a fix or a recommendation for a workaround.

kriewall avatar Feb 19 '22 01:02 kriewall