Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 979
Mike Avatar asked Feb 04 '10 15:02

Mike


1 Answers

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.

like image 52
NotDan Avatar answered Nov 07 '22 02:11

NotDan