Hi there,
I'm struggling to find the right way to test whether the right side of a join "is null."
e.g.
from po in linq.PurchaseOrder
join pod in linq.PurchaseOrderDetail on po.PurchaseOrderId equals pod.PurchaseOrderId
join si in linq.SupplierItem on pod.ItemId equals si.ItemId into supplierItems
from si in supplierItems.DefaultIfEmpty()
select new {
po.PurchaseOrderId,
SupplierItem = si,
SupplierItemId = si?.SupplierItemId
};
In the above case, when no matching SupplierItem row is found, si is a "default" blank entity, so SupplierItem is not null, and SupplierItemId has the value 0. I would like them to be null. What is the best way to achieve this? I could of course check for the value of 0 for SupplierItemId if I can guarantee that 0 is not a valid value, but that doesn't seem right.
I did try use DefaultIfEmpty(null) in the query, but that didn't seem to make any difference.
Thank-you in advance for the advice, and my apologies for the general question that may not actually be LLBLGen specific.