简体   繁体   中英

Entity Framework doesn't work with Nullable columns

I have problem with Entity Framework.

I have a table Victor with 3 nullable columns. When the wizard is finished, I can't see the nullable columns inside the CreateVictor() method, this method automatically is being generated by wizard not me.

After 4 hours I couldn't find any solution. This happens just for nullable column.

This is a 'feature' rather than a bug. The idea is that only the non-null columns are required to create a 'Victor'. So they are the only columns included in the CreateVictor() method.

If you want to set the other properties, you can do this with the object returned by CreateVictor().

var victor = Victor.CreateVictor(...);
victor.Name = "name";

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM