且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何将实体框架4.5设置为永不将任何属性设置为Nullable

更新时间:2023-01-31 20:30:14

即使您获得属性 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.