locked
How to splitting an extended entity RRS feed

  • Question

  • I want to split an extended entity.

    The original entity is Employee, that has the following propery: EmployeeID that is Primary Key of the entity, FirstName, LastName, Wage, Salary.

    The extended entity is ExtendedEmployee that has properties such as : EmployeeID (foreign key) and Email.

    In the edmx, both entity is combined into one entity. I want to split this entity into two other entities, PartTimer and FullTimer. However, this is not allowed in edmx. I got the following error when trying to validate:

    [Error]
    
    Problem in mapping fragments starting at line 90:Must specify mappingfor all key properties (Employee.EmployeeID) of table Employee.
    
    Problem in mapping fragments starting at line 85:Must specify mappingfor all key properties (Employee.EmployeeID) of table Employee.
    
    Problem in mapping fragments starting at line 90:Must specify mappingfor all key properties (Employees.EmployeeID) of the EntitySetEmployees.
    
    Problem in mapping fragments starting at line 85:Must specify mappingfor all key properties (Employees.EmployeeID) of the EntitySetEmployees.

    Here I attach the reference project, in case anyone wants to take a look. Any help is

    greatly appreciated. Thanks!

    Attachment
    Thursday, August 9, 2012 1:47 AM

All replies

  • Hi Andrew,

    You can "split" one entity by using partial classes.

    You should be able to accomplish this by creating a new (partial) class named Employee.PartTimer.cs (for example). Edit its namespace, by making it the same as the original Entity. Afterwards, you should be able to add new custom properties.

    Does this answer your question?

    Hope this helps!


    Cheers, Carlos Sardo

    Thursday, August 9, 2012 2:12 PM