I'm using EF 4 in my web application.
here are my relevant 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: Problem in mapping fragments starting at line 1565:Potential runtime violation of table AppToDomains_V1's keys (AppToDomains_V1.AppId, AppToDomains_V1.Domain): Columns (AppToDomains_V1.AppId, AppToDomains_V1.Domain) are mapped to EntitySet AppToDomains_V1's properties (AppToDomains_V1.AppId, AppToDomains_V1.Domain) on the conceptual side but they do not form the EntitySet's key properties (AppToDomains_V1.AppId, AppToDomains_V1.Domain, AppToDomains_V1.IsWhiteListed). D:\MaM\Server\MamAdmin\Dev\Admin 1.7\MaMDBEntityFramework\MaMModel.edmx 1566 15 MaMDBEntityFramework
How can I resolve this?
D:\MaM\Server\MamAdmin\Dev\Admin
1.7\MaMDBEntityFramework\MaMModel.edmx 1566 15 is:
<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>
I know this was a LONG time ago, but it is still showing up on search engines, so here's the deal.
The 3002 error indicates that there's a mismatch between the model and the actual database as to the primary key for a table. For example, the database may have only a single ID field as the primary key, but in the model it has two or more columns marked as part of the primary key. When I had this error, the model had marked all the non-null, foreign key fields as part of the primary key, which was not correct.
To fix, go into the model, locate the table, highlight every field that is erroneously marked as being part of the primary key, and change the "Entity Key" property to false. Recompile, and the error should be gone.
This worked for me.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With