foreign keys - Entity framework code first - association on "polymorphic" columns -
i have 3 tables:
1. invoice
invoiceid int primary key
2. order
orderid int primary key
3. transaction
transactionid int primary key
source int
category string
on table "transaction", source (unfortunately) behaving "polymorphic"(??) foreign key (there must actual term - sorry ignorance) depending on category column it'll contain id of invoice or order.
however there's no actual foreign key.
using ef 4.1 code first, has idea how create proper associations?
help appreciated! thanks
solution
uh... embarrassment kicking in... can map same way regardless of actual db foreign key.
i having problems while trying wasn't related this. had computation properties didn't ask context ignore generating wrong queries.
you should create 2 nullable fks instead of weak reference that.
Comments
Post a Comment