What is the best pairing of data types for money or currency in SQL Server and EFCore using C#?

1k Views Asked by At

What is the best combination of data types for money or currency in SQL Server and EFCore using C# ?

So, for example, if you're only working with 2 decimal places, should that just be decimal in C#? But what about EFCore and the column type in the SQL Server table?

Let's say I have a class property for Price defined like this: -

[RegularExpression(@"^\d+\.\d{0,2}$")]
[Range(0, 9999999999999999.99)]
public decimal Price { get; set; } 

How should this be represented in the SQL Server table? Which column type?

0

There are 0 best solutions below