Introduction

I was engaged on MVC application utilisation Entity Framework, MVC and Jquery. I hit the Save button to save corresponding values into database, however this did,'t happen fine as common, I got the special error An exception of type 'System.Data.Entity.Infrastructure.DbUpdateException' occurred in EntityFramework.dll but was not handled in user code.

Error Description

An exception of type 'System.Data.Entity.Infrastructure.DbUpdateException' occurred in EntityFramework.dll but was not handled in user code

Solution I

When I started operating to resolve issue, debugging deeply and found of stack trace message then I found that this issue was because of database table identity off.

Table Identity off

I simply set table Identity on and once more tried to save relevant values into database, this time it worked fine for me.
Table Identity On


Solution II

This Error A special case of sort An exception of type 'System.Data.Entity.Infrastructure.DbUpdateException' occurred in EntityFramework.dll but was not handled in user code yet was not took care of in client code likewise comes when duplicte value entering in primary key so you have to cross check to conquer this mistake.

Need to Refresh Entity Framework Model After Database Change

Once you set primary key in database then when you would like to refresh your entity framework model through front end code.

Conclusion

Another superb expertise of MVC, Entity Framework, Jquery application. Every time, in each new application usually comes new problems. From these issues, we learnt another lesson each time and smoothing approach to next time. Above, I have clarified in subtle element by what method would we be able to determine issue of A special case of sort An exception of type 'System.Data.Entity.Infrastructure.DbUpdateException' occurred in EntityFramework.dll but was not handled in user code. In the event that despite everything you locate the same issue, kindly keep in mind to think of me here.

Suggested Reading