Using dotConnect with foreign keys that are compound primary keys?
When I try to generate the data model, I get an error "The relationship XXX has columns that are not part of the key of the table on the primary side of the relationship."
Searching around, this seems to be a problem involving foreign keys and compound primary keys. I have:
- a table "patients" with compound primary key of "patient_id" + "mrn", and
- a second table "visits" with a foreign key to patient.patient_id, and its primary key is this foreign key + visits.visit_id column.
So... I'd appreciate any thoughts on any the following:
- Is there some clever (or straightforward) work-around for this?
- Is it safe to use the generated model without the relationships? Or should i assume that the model is simply broken and not use it? (note that while this is a medical system, the particular application I'm building is not something that will affect safety or change treatments.)
- If we can't get this approach to work, what's the recommended way to access our database from C# without EF?