Search code examples
visual-studio-2010entity-frameworkentity-framework-4

Entity framework with inheritance, condition, and foreign key


I just started to play around with Linq to entities and ran into an issue I can't figure out.

I am getting this error:

Condition member 'RelatedResources.TypeID' with a condition other than 'IsNull=False' is mapped. Either remove the condition on RelatedResources.TypeID or remove it from the mapping.

The condition that exists is a TypeID field in the abstract entity RelatedResource that defines the type of RelatedResource (Book, Link, guide, etc.). TypeID is also a foreign key and is mapped in the association with the Resource Type entity. I think this is the problem but I don't know how or why I should change this.


Solution

  • That usually happens when you have TypeID as a condition and also use it as a property. It might be causing problems because you are using it to map the association with ResourceType AND using it as a condition for the inheritance.