简体   繁体   中英

Any New Column is Null value in Entity Framework

I am adding a new column to exiting database table with values, but when I used the entity framework model, the column data value return Null, however its has a real value in database.

How solve this problem?

If you are using LINQ for data retrieval:

Double click and open edmx -> right click and select update from database -> select refresh tab and select your table and click ok.

The above will update your dbcontext file.

在此处输入图片说明

在此处输入图片说明

If you are using stored procedure, you will have to update the complex type of your stored procedure

The most likely explanation for your problem is that you did not COMMIT the changes you made to the database. Not the changes to the schema but the table updates. EF is returning NULL values because you did not commit your changes so the actual field values are ... NULL !

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