JK.
JK.

Reputation: 21810

Entity Framework Non-nullable column is mapped to a nullable entity property

I am getting this nullable column error message in Entity Framework 4.1 - when the column is not actually nullable:

Non-nullable column MyView.RunningTotal in table TransactionListView 
is mapped to a nullable entity property.

But you can see from the screenshots below that the column is not nullable and that the entity property is not nullable either. So why is this error occurring?

enter image description here

Upvotes: 9

Views: 11409

Answers (2)

DerpyNerd
DerpyNerd

Reputation: 4803

2017 Update (Visual Studio 2017)

If the accepted straight-forward solution mentioned by lLya didn't help you, then this might. You may notice that when you save a diagram it does some work, like changing the class properties according to your diagram changes. One would think that the generator itself would be aware of these changes, right?! You might still get this error.

What fixed it for me was regenerating the database (right click in diagram -> Regenerate Database from Model).

Upvotes: 0

ILya
ILya

Reputation: 2778

The straight-forward solution is to manually specify Nullable parameter to True.

Upvotes: 12

Related Questions