I have two entity CUSTOMER and ORDER..there is one to many relation from CUSTOMER to ORDER where CustomerID is primary key for customer and foreign key in ORDER..now I want to add customer name property from CUSTOMER entity in ORDER entity…I have copied this property and paste it in ORDER table and have added CUSTOMER table and map this property to the CUSTOMER table’s same property..but when i trying to validate it vs giving me a Error that is
3024: Problem in mapping fragments starting at line 239:Must specify
mapping for all key properties (ORDER.OrderID) of the EntitySet ORDER
That is not possible in mapping. You cannot add property from
Customertable intoOrderentity this way. Mapping properties from multiple tables to the same entity has very strict rules and it is not possible for this case.You can expose customer’s name in your Order class without defining it in the mapping. Create partial part of
Orderclass and add custom computed property (non mapped):This will require loading
Customerwith yourOrder(eager loading) or using lazy loading. Also this property cannot be used in Linq-to-entities queries.