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.

Published Sat, Aug 23 2008 15:37 by Matthieu MEZIL

Comments

# TPH Is Not NULL mapped on a relationship

As I wrote in a previous post , with EF V1, there is a limitation on the mapping of columns with the

Friday, August 29, 2008 4:07 AM by Matthieu MEZIL

Leave a Comment

(required) 
(required) 
(optional)
(required)