Last Updated: February 25, 2016
· blaiseliu
0 zdfer mextupleu3bexrr3szkfrkbdj3chrcr3youxf8zsotmf0kvtoxe7u7xapdqodnqquhhlpg

How to use Entity Framework Code First to create SQL Server money type?

There are a few data types in SQL server that have no corresponding type in C#, like money.

Here is what we are going to do.

In the domain models:

public decimal Price { get; set; }

Please note it has to be decimal. A double will not work.

And in the OnModelCreating method of the fluent api:

Property(i => i.Amount)
Say Thanks