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

asp.net asp.net-mvc entity-framework

Question

I mapped two tables and created scaffolding in MVC. After filling data in the form when I click on create button, below error occurs.

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

Additional information: A value shared across entities or associations is generated in more than one location. Check that mapping does not split an EntityKey to multiple store-generated columns.

1
5
10/15/2014 2:15:18 PM

Popular Answer

If cannot see any innerexception message that can help you (during debug), I have found the solution of the "Identity Specification" problem.

In SQL Management Studio (or in Server Explorer in Visual Studio) you have to open the table that causes your problem and select che primary key. Looking at its property you will find the "Identity Specification". You have to set it to "yes".

Source: http://www.technologycrowds.com/2015/07/system-data-entity-infrastructure-DbUpdateException.html

3
12/9/2015 3:42:54 PM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow