I'm building a WPF application. I made my database using Code-First.
I need to insert prices of items in pence (e.g. 500), but when prices will be displayed they should be in pounds (5,00).
I tried to do the "conversion" in the setter of my property
public decimal Price
{
get { return price; }
set { price = value/100 ;}
}
But, for some reason, when I drop manually the database, the values in my ListView
are shown some times like 0,05 and other times like 500,00. Something must be wrong with this method.
How can I tell my database to consider last 2 numbers of my value as decimal?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…