sql server - How do i assign 2 values from different tables into 1 variable name as foreign key using Entity Framework-Code First -
i'm confused foreign key concept. i'm trying arrange key relationships in each database class according code first concept in entity framework.
i have 3 tables: a, b , c.
table has aid
primary key(pk), table b has bid
pk, table c has cid
primary key. relationship between table is:
- a-b : many-to-one,
- a-c : one-to-one,
- b-c : one-to-many
table has variable refid can hold both bid or cid values.
<foreignkey("bid")> public property refid b <foreignkey("cid")> public property refid c
refid highlighted red saying
the properties cannot overload each other because differ return types.
what doing wrong?
edited
public class public property aid string // primary key public property refid string <foreignkey("refid")> public property b b <foreignkey("refid")> public property c c end class public class b public property bid string // primary key // b navigation property public property acol icollection(of a) end class public class c public property cid string // primary key // c navigation property public property acol icollection(of a) end class
Comments
Post a Comment