This is a simple question for sure, but I can't find the solution. It's the opposite of this question. In my case, I have a decimal and a string properties on my ViewModel, like this:
public string FactorText
{
get
{
if (this.Factor != 0)
{
return this.Factor.ToString();
}
}
set
{
this._factorText = value;
}
}
public decimal Factor { get; set; }
When the .ToString()
acts, it fills the number with zeroes at the right, e.g:
1.1
becomes1.100000000000000
1.9999999999
becomes1.999999999900000
... and so on. It fills the remaing of 15 decimal places with zeroes.
I don't really know why and if it have a way to make sure .ToString()
stops making that.
If this information is relevant, that Factor is mapped with Fluent NHibernate as follows:
Map((x) => x.Factor).Column("FACTOR").Precision(30).Scale(15).Not.Nullable();
I don't know if this can be the cause of that behaviour.
Thank you in adv.
Update: I just can't change the scale and precision. They match the column on the database definition that is Decimal(30,15)
.