Hello,
We are using dotconnect for Oracle v5.70.152 for generating Entity Framework.
We have a Product table with sku as PK and ProductDescription table with sku, languageId as composite PK. The sku in ProductDescription table is a FK to the (PK) sku column in Product table. When we generate the EF, the sku FK relationship is not mapped. If the FK is not part of a PK, the relationship is generated correctly.
Please let us know if this is a bug in the Devart EF.
Thanks.
AssociationSetMapping for Composite PK - Foreign Key
-
- Posts: 9
- Joined: Wed 26 May 2010 02:39
The problem is associated with the fact that you have a single-column entity key on one side of association, and a multi-column key on the other side.
There is no support for such association scenario in Entity Framework. There should be either association between two entity keys, or one of the association ends should not be a part of Entity Key.
There is no support for such association scenario in Entity Framework. There should be either association between two entity keys, or one of the association ends should not be a part of Entity Key.
-
- Posts: 9
- Joined: Wed 26 May 2010 02:39
I am able to create the association manually in the Designer as follows (in the .edml file).
The generated x.Designer.cs file also includes the below navigation properties for the Productdescription class.
Please let us know if it is a limitation of the Devart Entity designer to generate the AssociationSet automatically.
Code: Select all
Code: Select all
Code: Select all
#region Navigation Properties
///
/// There are no comments for Product in the schema.
///
[XmlIgnoreAttribute()]
[SoapIgnoreAttribute()]
[DataMemberAttribute()]
[EdmRelationshipNavigationPropertyAttribute("x", "Product_Productdescription", "Product")]
public Product Product
{
get
{
return ((IEntityWithRelationships)(this)).RelationshipManager.GetRelatedReference("x.Product_Productdescription", "Product").Value;
}
set
{
((IEntityWithRelationships)(this)).RelationshipManager.GetRelatedReference("x.Product_Productdescription", "Product").Value = value;
}
}
///
/// There are no comments for Product in the schema.
///
[BrowsableAttribute(false)]
[DataMemberAttribute()]
public EntityReference ProductReference
{
get
{
return ((IEntityWithRelationships)(this)).RelationshipManager.GetRelatedReference("x.Product_Productdescription", "Product");
}
set
{
if (value != null)
{
((IEntityWithRelationships)(this)).RelationshipManager.InitializeRelatedReference("x.Product_Productdescription", "Product", value);
}
else
{
((IEntityWithRelationships)(this)).RelationshipManager.GetRelatedReference("x.Product_Productdescription", "Product").Value = null;
}
}
}
#endregion
-
- Posts: 9
- Joined: Wed 26 May 2010 02:39