Error 3034: Problem in Mapping Fragments starting at lines ...
Hallo,
I have some problems while trying to set associations between derived type.
EF-Validation throws 6 exceptions:
Error 1 Error 3034: Problem in Mapping Fragments starting at lines 6250, 7344: Two entities with different keys are mapped to the same row. Ensure these two mapping fragments do not map two groups of entities with different keys to two overlapping groups of rows.
Error 2 Error 3034: Problem in Mapping Fragments starting at lines 6273, 7344: Two entities with different keys are mapped to the same row. Ensure these two mapping fragments do not map two groups of entities with different keys to two overlapping groups of rows.
... and so on (with different line 6... , 7344)By doubleclicking each Error, EDM Designer jumps to Derived Entities or Association
Tables:
OrderItem
ID_OrderItem - guid - PKType - tinyint - Discriminator for Inheritance
ID_Customer - guid - FK (to table Customer)
Name
...
ID_Server - nullable(guid) - FK (to table Server)
ID_VPServer - nullable(guid) - FK (to table VPServer)ID_Webspace - nullable(guid) - FK (to table Webspace)
ID_Domain - nullable(guid) - FK (to table Domain)
Server
ID_Server - guid - PK
...VPServer
ID_VPServer - guid - PK
ID_Server - nullable(guid) - FK (to table Server)
...
Webspace
ID_Webspace - guid - PK
ID_VPServer - guid - FK (to table VPServer)
...
Domain
ID_Domain - guid - PK
ID_Webspace - nullable(guid) - FK (to table Webspace)
Now my problem:
The EDM-Designer creates some associations from Server->OrderItem /VPServer->OrderItem/Webspace->OrderItem/...
I now create some derived OrderItems (ServerOrderItem / VPServerOrderItem / WebspaceOrderItem / ... ) and all is fine.
But, when I delete designergenerated associations and try to map them to the derived types (Server->ServerOrderItem / VPServer->VPServerOrderItem/...) I got the exception sdescribed at the beginning. The error comes after mapping the second association to a derived OrderItem
So whats the meaning of these exceptions and how can I avoid it ?
Could it be, that a circular reference (OrderItem->Customer->Task->Server->OrderItem) cannot be handled this way?
I can send *.edmx but it's really big (8200 rows)
Thanx
Stefan
All Replies
If I understand well, you want to have the relationship between the derived entity type and another entity type.
If it's what you want, you should look at here. I think you don't delete the relationship in the SSDL but only in CSDL. If you use the designer to delete the relationship, you will have this problem.
Hello,
No, that isn't it.
What I want is, that the Associations (NavigationProperties) are only in derived entities.
Example:
In Database
Table: "OrderItem" has all columns of derived entities and column 'Type' is discriminator and there are columns 'ID_Server', 'ID_VPServer', and so on, associated with table "Server", "VPServer", and so on
In C-S
Entity "OrderItem" has 'Type' = 0
Entity "ServerOrderItem" derives from "OrderItem" with condition 'Type' = 1
Entity "VPServerOrderItem" derives from "OrderItem" with condition 'Type' = 2
...
The EDM-Designer generates entity "OrderItem" with associations to "Server", "VPServer", and so on.
But I want to have "OrderItem" without association to "Server","VPServer", ... and every derived OrderItem should have its own association like "ServerOrderItem" to "Server" or "VPServerOrderItem" to "VPServer".
If I try to delete in C-S the association from "Server" to "OrderItem" and then create a new one from "Server" to "ServerOrderItem", from "VPServer" to "VPServerOrderItem", and so on, I get the described ErrorMessage.
I have a similar construction with "IP" (derived entities are "ServerIP", "VPServerIP", ... with my newly created associations from "Server" to "ServerIP" , "VPServer" to VPServerIP" ... and this goes without exceptions.
The only difference to the "OrderItem"-Sample is that "OrderItem" has more associations to "Customer" and to "Task" and so on. That's why my question about circular references.
Thanx
Stefan
Hi stefan
I have the same error . Do you get any solution to this error? When i used the beta vesion of edm i' had not this problem. And when i install the service pack 1 the problem comes. If you have any solution please help me.
Thanks
Ok, I do this:
-
Delete the relationships between OrderItem and Server and between OrderItem and VPServer
-
Open your edmx with the xml editor and remove the relationship in SSDL
-
Open your edmx with the designer and add ServerOderItem and VPServerOrderItem entity types. Then do the TPH (don't forget to add the condition (= 0 to OrderItem)
-
Add the relationships between ServerOrderItem and Server and between VPServerOrderItem and ServerOrderItem
It should be good.
-
Thanks for your answer but what is the meaning of "TPH".
Thanks
- Table Per Hierarchy. You should look at this (page 20).
- If you want to use the Designer to do TPH mapping, this might be helpful in understanding some of the basics: Walkthrough: Mapping Inheritance - Table-per-Hierarchy.
Hope that helps.
-Brian
Matthieu,
I have the same errors with a slightly different situation where your steps above did not solve the problem:
I have two storage tables that are related by FK, and both represent TPH types in the conceptual side.
I define both base types as abstract, and put the proper conditions in each type mapping for the sub-types. With a relationship between the two base types, no problem. However, I want to map the proper sub-types to proper sub-types, rather than a relationship at the top level between abstract base types.
When I map the sub-types I get this 3034 error, yet there is no conflicting relationship between the base types.
Any thoughts?
Thanks.
- check out my blog entry on a similar issue
http://csentities.wordpress.com/2009/10/07/adding-filter-to-the-dynamic-data-application-page-blog-post-5/Ashwani Roy
Please click the Mark as Answer button if a post solves your problem!
I had to add the Condition on the column to make the error go away.
<AssociationSetMapping Name="TransducerInventoryTrappedTransducers" TypeName="ILOModel.TransducerInventoryTrappedTransducers" StoreEntitySet="TrappedTransducers">
<
EndProperty Name="TransducerInventory">
<
ScalarProperty Name="TransducerID" ColumnName="SensorSerial" /></EndProperty>
<
EndProperty Name="TrappedTransducers">
<
ScalarProperty Name="ID" ColumnName="ID" /></EndProperty>
<
Condition ColumnName="SensorSerial" IsNull="false" />
</
AssociationSetMapping>
- Note that if you create an association between subtypes, the designer automatically adds this condition for you. At least...it should, if it did not do this, then that would be a designer bug...
This posting is provided "AS IS" with no warranties, and confers no rights.


