'How to create read-only entity in Entity Framework?
My app is purely read-only so I don't want to generate all the update & delete code, and I don't want to pull in all fields from all tables. Some of these fields are not nullable so I am getting errors from EF here becasue there is no default value to save.
In my previous ORM (Wilson) you could just flag an entity as read-only in the XML. I've seen a few posts showing convoluted solutions to this. Am I missing something? Why isn't this straight forward?
I see that the RIA services wizard has a check box for this for each entity...
Solution 1:[1]
The problem is that you have a non-nullable field in your SSDL which isn't in your CSDL.
You can manually remove the column from SSDL and the EF will be happy. But the designer will re-add the column when you update the model. So you can either remove it again or update your model from a variant of the DB which doesn't have that column.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Craig Stuntz |
