entity-frameworkentity-framework-6ef-model-first

Entityframework model first decimal precision


I'm using Entityframework 6 with model first. In the diagram I have chosen decimal for my datatype. When I save decimal values, the database only has whole numbers and the decimals get dropped.

My first suspicion was to check the precision, however going to the properties window from the model first diagram designer, the precision and scale dropdowns have no other options besides "None".

How do I get EF to save my decimals? Is it a precision issue? If so, how do I set the precision in this case?


Solution

  • OK I feel a little silly for not figuring this out earlier, but this is a simple fix.

    In the properties window for the column in the edmx designer, both precision and scale are a drop down menu, however it still lets you type in it. So I just typed 2 in for scale, hit enter, and it worked.

    Not sure why they have it setup to be a drop down if they don't provide you with any preset values and expect you to type it in.