UseDatabaseNullSemantics still generating NULL checks

前端 未结 2 1337
失恋的感觉
失恋的感觉 2021-01-14 15:16

I have this on my context object (constructor):

this.Configuration.UseDatabaseNullSemantics = true;

But even with this set, this query:

2条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-01-14 15:39

    Does this work? If the posted query is correct when you remove the (or (is null and is null)) clause, then I think this will execute the same query. (This assumes there isn't a logic error in the joins, as suggested in other posts.)

    var query = (from i in _repo.Invoices
        from o in _repo.Orders.Where(c => c.orderid == i.orderid)
        from o2 in _repo.Orders.Where(c => c.linkedorderid == o.linkedorderid).DefaultIfEmpty()                          
        where invoiceIds.Contains(i.invoiceid)
        select new
        {
           i, o2
        }).ToList();
    

提交回复
热议问题