NHibernate does not respect precision and scale for creating a numeric column (for decimal)

I have a FluentNHibernate-Mapping definition:

this.Map(x => x.Discount).Precision(8).Scale(2).Not.Nullable(); 

And this property in the object for discount:

public virtual Decimal Discount { get; set; }   

But the schema (for SQL-Server) created by NHibernate now contains:

Discount NUMERIC(19, 0) not null,

Can someone help me what is wrong?

+5
source share
1 answer

What version of FNH / SQL Server are we talking about? Is there a special reason for using Precision () and Scale ()? There is no benefit in reducing the size of the database ... My suggestion is to remove both, let NH handle this property and use getter / Formatstring instead.

0
source

All Articles