Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

An exception of type 'System.InvalidOperationException' occurred in EntityFramework.dll but was not handled in user code

An exception of type 'System.InvalidOperationException' occurred in EntityFramework.dll but was not handled in user code


Solution :

This is a very common message appears when you modify existing Table or add a new table. This appears because EF stores entity information in database itself and that is not updated since you modified table structure through your Code. Now, all you need is perform Code First Migration . Do this migration every time you modify or add new entity.

If using Code First then enable code first migrations
1. Add entity class
2. enable migration from package manager consol
3. update databse from package manager consol

If using model first approach then Update edmx file. 

Users Please post your solution too.


This post first appeared on Asp.netSourceCodes, please read the originial post: here

Share the post

An exception of type 'System.InvalidOperationException' occurred in EntityFramework.dll but was not handled in user code

×

Subscribe to Asp.netsourcecodes

Get updates delivered right to your inbox!

Thank you for your subscription

×