[英]How to set entity framework 4.5 to never set any property as Nullable
The one feature that I cannot stand with-in the Entity framework is where the complex Result object sets some properties as Nullable. 在实体框架中,我不能忍受的一个功能是复杂的Result对象将某些属性设置为Nullable。
Is there a global setting to where that Nullable property is never set to yes? 是否存在将Nullable属性从不设置为yes的全局设置?
It appears that even if you get the property Nullable
to be False
, that it will still generate a Nullable
version of your object. 看起来,即使您将Nullable
属性设置为False
,它仍然会生成对象的Nullable
版本。
Check out the accepted answer of Entity Framework: Set nullable to false, but type is still nullable . 查看Entity Framework可接受的答案:将nullable设置为false,但是type仍然可以为null 。
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. 另外,请阅读如何在实体框架模型类与数据库不同步时如何手动更新它们,以获取有关在模型生成后如何使用“ Run Custom Tool
选项运行T4模板的说明。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.