locked
Mapping 1-0..1 Nightmare RRS feed

  • Question

  • Ok, so here is my table definition:

    Assessments

    --------------

    AssessmentId (PK)

    AssessmentDate

     

    HealthAssessments

    ----------------------

    AssessmentId (PK - FK to Assessments)

    HealthAssessmentAttributes

     

    LifestyleAssessments

    ------------------------

    AssessmentId (PK - FK to Assessments)

    LifestyleAssessmentAttributes

     

    In this scenario an Assessment can have both a PhysicalAssessment and a HealthAssessment. Basically assessment is a way to group different types of assessments together. 

     

    For my domain, I want to at least have type per table. With the subtypes including the parent's information. So for example:

     

    Assessment

    --------------

    Id

    Date

     

    HealthAssessment : Assessment

    HealthAssessmentAttributes

     

    LifestyleAssessment : Assessment

    LifestyleAssessment

     

    I tried TPT, and that works until I add the second subtype (in this case LifestyleAssessment). When I add I receive a "All objects in the EntitySet must have unique primary keys". Help please! 

    Sunday, December 12, 2010 9:55 PM

Answers