Model first of EF, how to define navigation property relationship without setting foreign key between tables in database

时间:2016-08-31 18:15:31

标签: c# entity-framework

I want to create following two tables,

  1. Driver table with following columns(DriverId,DeptId,Version,CarNo, License)
    DriverId is primary key, DeptId,Version,CarNo forms unique keys.

    • DeptId will have duplicate values in this table
  2. and I want to create DriverTrips table with (DeptId, TotalIncome) column. My question is in Entity Framework how can I make use of navigation properties, if there is no foreign key relationship ?Is that possible? Basically, I don't want to repeat DeptId values in this table.

I looked at many other posts did not get any answer. Any help to guide me in a right direction is appreciated.

0 个答案:

没有答案