Error 3033: Problem in mapping fragment

  • Thread starter Thread starter Juan Dent
  • Start date Start date
J

Juan Dent

Hi,

I am trying to follow the How to: Define a model with single entity mapped
to two tables, but I am getting the following error as I validate the model:

EntitySets 'Store' and 'Customer' are both mapped to table 'Customer'. Their
primary keys may collide.

the mapping xml for the Store EntitySet is like so:


<EntitySetMapping Name="Store">
<EntityTypeMapping TypeName="IsTypeOf(AdventureWorksModel.Store)">
<MappingFragment StoreEntitySet="Customer">
<ScalarProperty Name="TerritoryID" ColumnName="TerritoryID" />
<ScalarProperty Name="CustomerID" ColumnName="CustomerID" />
<ScalarProperty Name="AccountNumber"
ColumnName="AccountNumber" />
<ScalarProperty Name="CustomerType"
ColumnName="CustomerType" />
<ScalarProperty Name="Cust_rowguid" ColumnName="rowguid" />
<ScalarProperty Name="Cust_ModifiedDate"
ColumnName="ModifiedDate" />
</MappingFragment>
<MappingFragment StoreEntitySet="Store">
<ScalarProperty Name="CustomerID" ColumnName="CustomerID" />
<ScalarProperty Name="Name" ColumnName="Name" />
<ScalarProperty Name="Demographics"
ColumnName="Demographics" />
<ScalarProperty Name="rowguid" ColumnName="rowguid" />
<ScalarProperty Name="ModifiedDate"
ColumnName="ModifiedDate" />
</MappingFragment>
</EntityTypeMapping>
</EntitySetMapping>
 
Hello Juan Dent,

I followed the document "How to: Define a Model with Single Entity Mapped
to Two Tables"(http://msdn.microsoft.com/en-us/library/bb896233.aspx) as
you mentioned. But, I did not reproduce the issue. The following is what I
have done on my side,

1.Firstly, I created a LINQ to entity item from the AdventureWorks database
with the tables Customer and Store in it.

2.I copied the three XML code snippets "ConceptualModels", "StorageModels",
"Mappings" from the above link into the AdventureWorks.edmx file, to
replace the corresponding parts of the original document.

3.Afterwards, I could compile and consume the single entity, which was
mapped to two tables, in my project correctly.

I saw that the XML code you posted was a modified version, but that looked
pretty right to me, and I also pasted it into my AdventureWorks.edmx file
for a test. It still worked fine. From the error description, I think this
issue may result from the storagemodels' mismatch. So, to better
troubleshooting this issue, would you mind sharing some more information?
The whole AdventureWorks.edmx will be preferred, and you can send it to my
email at (e-mail address removed). If that is inconvenient for you, posting the
three parts, "ConceptualModels", "StorageModels", "Mappings" of the
AdventureWorks.edmx file will also be helpful.

This information is supposed to be collected for narrowing down the
problem. I appreciate your understanding, as well as your time and effort
on collecting and sending it.

Have a nice day!

Best regards,
Ji Zhou ([email protected], remove 'online.')
Microsoft Online Community Support

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/en-us/subscriptions/aa948868.aspx#notifications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://support.microsoft.com/select/default.aspx?target=assistance&ln=en-us.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
 
Back
Top