Miguel Moura
Miguel Moura

Reputation: 39394

Data Type for Currency in Entity Framework

What data type should I use to hold currency values in Entity Framework 6 and what data type should I map it in SQL Server 2012?

Thank You, Miguel

Upvotes: 4

Views: 5284

Answers (1)

marc_s
marc_s

Reputation: 754518

To have precise values, use decimal in C#, and also decimal(m, n) in SQL Server. float or double or real just aren't precise and will be susceptible to rounding errors - I'd avoid those.

See this other SO question (and its answers) for a discussion of money vs. decimal in SQL Server and why you should avoid money in SQL Server.

Upvotes: 7

Related Questions