Framework for Entities A nullable entity property is mapped to a non-nullable column.

c# entity-framework mapping nullable poco

Question

Entity Framework 4.1 is giving me this nullable column error notice even though the column is not truly nullable:

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

However, as you can see from the screenshots below, neither the entity property nor the column are nullable. So why is this mistake happening?

enter image description here

1
8
4/10/2012 1:54:29 AM

Accepted Answer

Setting the Nullable argument to True manually is the simple fix.

12
4/13/2012 1:10:55 PM

Popular Answer

As of 2017 (Visual Studio 2017)

This could be helpful if the well-liked straightforward approach lLya suggested didn't. You may have noticed that when you save a diagram, some work is done, such as updating the class attributes to reflect the changes in the diagram. One would assume that the generator would be aware of these modifications, wouldn't they? This error can still appear.

Regenerating the database (right click on the diagram and choose Regenerate Database from Model) was what I found to be the solution.



Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow