Как делают Вас оставленный, участвуют в Linq, если существует больше чем одно поле в соединении?

Windows и Eclipse работают хорошо, как pmiller предложенный. Я могу также рекомендовать OS X или с Eclipse или с ИДЕЕЙ IntelliJ (последний также работает над Windows, также).

я только когда-либо делал самую основную разработку Java на Солярисе (практика программирования структур основных данных в Университете), таким образом, я не могу предложить реальное сравнение, я боюсь. Я действительно находил его довольно болезненным на Солярисе, тем не менее, из-за отсутствия надлежащих инструментов (я думаю, что был ограничен nedit или чем-то).

12
задан Community 23 May 2017 в 12:01
поделиться

1 ответ

I think you need to use the into keyword and resolve the missing children's DefaultIfEmpty() after the join, not before:

...
join pstr in LinqUtils.GetTable<PayerServiceTypeRules>()
on new { auth.PayerID, tpd.ServiceTypeID, bool RequiresPrescription = true } 
equals new { pstr.PayerID, pstr.ServiceTypeID, pstr.RequiresPrescription } 
into pstrs
from PSTR in pstrs.DefaultIfEmpty()
select new { 
    Payer = auth.Payer, 
    Prescription = rx, 
    TreatmentPlanDetail = tpd, 
    Rules = PSTR 
};

LinqUtils.GetTable().DefaultIfEmpty() is probably turning up a null because the DataTable returned contains no rows, thus causing your exception. Note the entire statement after in will be executed before selecting into it, which is not your desired behavior. You want the matching rows or null if no matching rows exist.


For the boolean problem, it is a naming problem (nothing matches "RxReq" on the right side and nothing matches "RequiresPrescription" on the left side). Try naming the true "RequiresPrescription" as I have above (or name the right side's pstr.RequiresPrescription "RxReq").

15
ответ дан 2 December 2019 в 20:41
поделиться
Другие вопросы по тегам:

Похожие вопросы: