TPT with designer can generate errors 3034 or 3021
I found two cases of errors generated by the EDM designer when you want to do TPT.
Error 3034:
Imagine the following scenario:
- A table Contacts
- A table Employees
- ContactID (PK)
- OfficeID (Nullable, FK to Offices.OfficeID)
- A table Offices
To do TPT between Contacts and Employees with designer, I do the following:
- I delete the relationship between Employees and Contacts.
- I also delete Employees.EmployeeID property.
- Then I add inheritance between Employees and Contacts.
- Then, always with designer, I remap the Employees entity type and the relationship between Employees and Offices
Here I have an error because the designer "forgets" the condition IsNull=false in the relationship mapping.
Error 3021
Imagine the following scenario:
- A table Contacts
- A table Employees
- A table Hodidays
- EmployeeID (PK, KF to Employees.ContactID)
- From (PK)
I want to do TPT as previously.
In this case, I have an error 3021 because the designer "forgets" the CSDL association ReferentialConstraint which is inevitable if the FK is in the PK.
So ok, there are some bugs in the designer but don't forget that designer is just here for help. So these bugs don't prevented you to use EF. 