0

I have a table Person with a Primary Key of PersonId. I have another table CheckDetails with a column named DirectorId. There is a Foreign Key between Person.PersonId and CheckDetails.DirectorId. It is a 1-to-Many relationship

I created 3 entities: Person, Director, and CheckDetail.

Person maps back to the Person table and has PersonId as its key.

Director inherits from Person and has an ICollection of CheckDetail.

CheckDetail has Director property named Director.

I used the following when mapping Director:

HasRequired( d => d.CheckDetails ).WithMany( ).HasForeignKey( d => d.PersonId );

but I get the following error: The foreign key component 'PersonId' is not a declared property on type 'Director'. Verify that it has not been explicitly excluded from the model and that it is a valid primitive property.

How do I create this association?

4

0 回答 0