C# LINQ延迟执行并在左外部联接中返回null
我有两个问题,请看以下代码:C# LINQ延迟执行并在左外部联接中返回null,c#,entity-framework,orm,entity-framework-4.1,C#,Entity Framework,Orm,Entity Framework 4.1,我有两个问题,请看以下代码: var table1 = from a in test1 join b in test2 on a.column1 equals b.column1 into jo from jb in jo.DefaultIfEmpty() select new { col1 = jb == null ? <question 1> :
var table1 = from a in test1
join b in test2 on a.column1 equals b.column1 into jo
from jb in jo.DefaultIfEmpty()
select new
{
col1 = jb == null ? <question 1> : jb.column1
}
var table2 = from a in test3
join b in test4 on a.column1 equals b.column1 into jo
from jb in jo.DefaultIfEmpty()
select new
{
col1 = jb == null ? <question 1> : jb.column1
}
var table3 = from x in table1
join y in table2 on x.col1 equals y.col1 into jo
from jb in jo.DefaultIfEmpty()
{
col1 = jb == null ? <question 1> : jb.col1
}
var table4 = from z in table1.Concat(table2)
select new TheTables()
{
column1 = x.col1
}
第二个问题:根据我上面给出的代码,当我执行“table4.List()”时,它会以组合语句的形式查询数据库,还是会查询table1,然后查询table2,然后将其作为table3加入内存?我想你的意思是从jb in jo.DefaultIfEmpty()哈哈哈,很抱歉我错过了这一点,谢谢你的提示。:)
The argument to DbIsNullExpression must refer to a primitive, enumeration or reference type.