How to solve EF: Potential table runtime violation

I am using EF 4 in my web application.

here are my respective tables:

**AppToDomains_V1 ** GroupId uniqueidentifier AppGuid uniqueidentifier **Apps table** AppName nvarchar(50) AppGuid uniqueidentifier ClientAppID nvarchar(50) IsDeleted bit CreatedDate datetime UpdatedDate datetime 

and my edmx:

http://ge.tt/17n6R2e/v/0?c

I get the following error:

Error 2 Error 3002: a problem with displaying fragments starting from line 1565: Potential violation of the runtime of the table. Keys AppToDomains_V1 (AppToDomains_V1.AppId, AppToDomains_V1.Domain): Columns (AppToDomains_V1.AppId, AppToDomains_V1.Domain) are mapped to the EntitySet Properties of AppToDomDomDainDenDVDVains_V1 (AppToDomDomDainDVD_Vains_VIEW). AppId, AppToDomains_V1.Domain, AppToDomains_V1.IsWhiteListed). D: \ MaM \ Server \ MamAdmin \ Dev \ Admin 1.7 \ MaMDBEntityFramework \ MaMModel.edmx 1566 15 MaMDBEntityFramework

How can i solve this?

D: \ MaM \ Server \ MamAdmin \ Dev \ Admin

1.7 \ MaMDBEntityFramework \ MaMModel.edmx 1566 15:

  <EntitySetMapping Name="AppToDomains_V1"> <EntityTypeMapping TypeName="MaMDBModel.AppToDomains_V1"> <MappingFragment StoreEntitySet="AppToDomains_V1"> <ScalarProperty Name="IsWhiteListed" ColumnName="IsWhiteListed" /> <ScalarProperty Name="Domain" ColumnName="Domain" /> <ScalarProperty Name="AppId" ColumnName="AppId" /> </MappingFragment> </EntityTypeMapping> </EntitySetMapping> 
+6
source share
1 answer

I know that this was a long time ago, but it still appears in search engines, so here's the deal.

Error 3002 indicates that the model and the actual database do not match the primary key for the table. For example, a database may contain only one identifier field as a primary key, but in a model it has two or more columns marked as part of the primary key. When I had this error, the model marked all non-zero fields of the foreign key as part of the primary key, which was incorrect.

To fix the error, go to the model, find the table, select each field that is mistakenly marked as part of the primary key, and change the "Property of the object" property to false. Recompile and the error should go away.

It worked for me.

+14
source

All Articles