如何将实体框架4.5设置为永不将任何属性设置为Nullable [英] How to set entity framework 4.5 to never set any property as Nullable
问题描述
在实体框架中,我不能忍受的一个功能是复杂的Result对象将某些属性设置为Nullable。
The one feature that I cannot stand with-in the Entity framework is where the complex Result object sets some properties as Nullable.
在哪里有全局设置
推荐答案
即使您获得属性 Nullable $ c $,似乎c>为
False
,它将仍然生成对象的 Nullable
版本。
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,但类型仍为null 。
此外,请阅读如何手动更新实体框架模型类当它们与您的数据库不同步时,以描述如何在生成模型后使用运行自定义工具
选项运行T4模板。
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.
这篇关于如何将实体框架4.5设置为永不将任何属性设置为Nullable的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!