如何在可为null的动态Linq GroupJoin期间忽略可为null的值<;int>;专栏?
下面的代码用于SecurityID整数列上的动态groupjoin 但是它包含的结果集的值可以为null如何在可为null的动态Linq GroupJoin期间忽略可为null的值<;int>;专栏?,linq,join,dynamic,Linq,Join,Dynamic,下面的代码用于SecurityID整数列上的动态groupjoin 但是它包含的结果集的值可以为null var innerJoin = source.AsQueryable().GroupJoin(destination.AsQueryable(), "new (outer.SecurityId as SecurityId)", "new (inner.SecurityId as SecurityId)", "new (outer as sources, group as destinati
var innerJoin = source.AsQueryable().GroupJoin(destination.AsQueryable(),
"new (outer.SecurityId as SecurityId)",
"new (inner.SecurityId as SecurityId)",
"new (outer as sources, group as destinations)").
SelectMany("destinations", "new(outer.sources as sources, inner as destinations)");
我们希望避免上述查询中的空值。上面的查询执行innerjoin,如果我们在字符串列上有连接,则可以正常工作
请帮助我们实现上述查询,以便对可能具有“null”值的整型列执行内部联接。首先,您不能将null分配给int,而是需要使用
null
/int?
。如果是这种情况,那么只需使用Where
子句过滤源代码,然后执行GroupJoin
。我认为这是最简单的方法。首先,您不能将null赋值给int,而是需要使用null/int?
。如果是这种情况,那么只需使用Where
子句过滤源代码,然后执行GroupJoin
。我认为这是最简单的方法