3
我在DB 2個表 - 一個是EmploymentRecords
一個是EmploymentVerificationRecords
LINQ結合2個表到一個列表
我要查詢兩個表,並返回一個列表
我有一個模型(簡化的例子):
Public Class Record
{
int ID {get; set;}
string name {get; set;}
bool IsVerification {get; set;}
}
我希望有一些類型的查詢,在LINQ,如:
var records = from a in _context.EmploymentRecords
join b in _context.EmploymentVerificationRecords on a.id equals b.id
where a.UserID = 1
select new Record() { .ID = a.id, .name = a.name, .IsVerification = false}
// I also want to select a new Record() for each b found
看 - 我也希望有一個新的Record()
加入結果在第二個表中的每個記錄,這些結果IsVerification
將True