Apologies for the long post!
I've been going through your book over the past few weeks in order to assess EF for my company. Unfortunately, it's not been an easy ride . It seems that pretty much everything I try to do with the book examples fail. So, I created my own, trivially simple, database and entity model to test some inheritance with. This also failed to work. Having read much about EF v1's limitations I have also tried my same example on a Windows 7 VM running VS2010 and .Net 4 (Beta 1). Again, same results.
Attached is a VS2008 solution containing a SQL 2005 Database Project and a Class Library for the Entity Model.
All I am trying to do is use some TPH Inheritance to create a Client entity that extends the Person entity. Steps taken...
- Add an Entity to the Designer called Client with a Base type of Person.
- Add the Person table to the mappings collection of Client.
- Select the PersonTypeID as a condition and set its value to 1.
I then receive the following error:
Error 3032: Problem in Mapping Fragment starting at line 106: Condition member 'Person.PersonTypeID' with a condition other than 'IsNull=False' is mapped. Either remove the condition on Person.PersonTypeID or remove it from the mapping.
I think the problem might be that the item I want to use in the Condition forms part of the FK for the Person <-> PersonType relationship. In your example of extending Lodging to Resort you were able to 'massage' the conditional property (Resort bit) in the base class. This option doesn't seem to be available in my example.
What concerns me is that this is the first, most simple example I could think of for switching to an entity modelling layer and it doesn't seem to work . Any help or fixes would be very much appreciated.
Number of downloads: 150