问题
The one feature that I cannot stand with-in the Entity framework is where the complex Result object sets some properties as Nullable.
Is there a global setting to where that Nullable property is never set to yes?
回答1:
It appears that even if you get the property Nullable
to be False
, that it will still generate a Nullable
version of your object.
Check out the accepted answer of Entity Framework: Set nullable to false, but type is still nullable.
Also, read How to manually update your Entity Framework model classes when they get out of sync with your database for a description of how to use the Run Custom Tool
option to run a T4 template after your model has been generated.
来源:https://stackoverflow.com/questions/18434409/how-to-set-entity-framework-4-5-to-never-set-any-property-as-nullable