from records in DBContext.Table1
join history in DBContext.Table2 into recordhistory
from records in recordhistory.DefaultIfEmpty()
select (n => n);
The error I got is "The null value cannot be assigned to a member with type System.Guid which is a non-nullable value type."
Can someone advise me on this? Thank you very much.
Assuming you have an ID property, following should work as inner join:
var result = DBContext.Table1
.Join(DBContext.Table2, t1 => t1.ID, t2 => t2.ID, (t1, t2) => t1);
I guess, the query, you provided, shoulg give an error, saying that on
statement should be specified. So, I guess it should look somewhat like this:
from records in DBContext.Table1
join history in DBContext.Table2 on records.ID equals history.ID into temp
from recordhistory in temp.DefaultIfEmpty()
select new { Record = records, History = recordhistory };
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.