я пишу выражение linq, которое объединяет разные столбцы в разных таблицах. в Asp. net ноль - PullRequest
0 голосов
/ 31 марта 2020

Вы можете видеть, что оператор Sql имеет три разные таблицы ie "Контракт", "ClientSessions" и "ContractInfo", который является представлением в базе данных

select c."AuditNotes" as "Audit", ci.* from "ContractInfo" ci inner join "Contracts" c on ci."ContractId"=c."Id" where (c."Fees">0) and (c."AutoRenew" is true) and exists (select from "ClientSessions" cs where cs."ContractId"=c."Id" and "ScheduledTime" between now()-interval '1 month' and now() and "Status" in (1,2) and "IsDeleted" is false) and not exists (select from "Invoices" i where i."ContractId"=c."Id" and i."InvoiceDate">now()-interval '1 month'-interval '15 day') and ({HIDEOK}='' OR c."AuditNotes" not like 'OK %')

Это Asp. net API нулевого Wep. какое выражение linq будет обращаться к базе данных.

public async Task<PagedResultDto<MonthlyBillingContractSessionsReportOutputDto>> GetMonthlyBillingContractSessionsReport(MonthlyBillingContractSessionsReportOutputDto input) { try { var query = await _userRepository.GetDbContext() .Query<MonthlyBillingContractSessionsReport>() .Take(10) .ToListAsync(); } }

...