TPH limitation which should disappear with v2

When you have a condition like myColumn Is Not Null, you must map the column on a non nullable property BUT with EF v1, you can’t map the column on a relationship (even if the cardinality is one).

For example,

I have two tables:

  • Customers
    • CustomerId (PK)
    • CompanyName
  • Contacts
    • ContactId (PK)
    • Name
    • CustomerId (FK to Customers.CustomerId NULL)

In my EDM, I want three entity types:

  • Customer
  • Contact (with no association to Customer)
  • CustomerContact (with an association to Customer)

For this,

  • I delete the relationship in MSL, CSDL and SSDL.
  • I use TPH between CustomerContact and Contact with CustomerId Is Null for Contact and CustomerId IsNot Null for CustomerContact.
  • Then I add an association between CustomerContact and Customer with a cardinality one to many.

I have an error:

Error 3022: Problem in Mapping Fragment starting at line 63: Property Contacts.CustomerId with ‘IsNull=false’ condition must be mapped.

But it’s wrong. I mapped Contacts.CustomerId on the relationship.

This entry was posted in 7671, 7674, 7675. Bookmark the permalink.

One Response to TPH limitation which should disappear with v2

  1. Shimmy says:

    I am having the same issue!!

Leave a Reply

Your email address will not be published. Required fields are marked *