У меня следующая ситуация:
var totalRecords = (from entry in invalidAccEntryRepository
select entry).Where(entry =>
entry.CustomerAccountInfo.CustomerAccountName == CustomerAccountName &&
entry.CustomerAccountInfo.CustomerAccountId == CustomerAccountId).Count();
против
var totalRecords = (from entry in invalidAccEntryRepository
select entry);
if (CustomerAccountInfoFilterActive)
{
totalRecords.Where(entry =>
entry.CustomerAccountInfo.CustomerAccountName == CustomerAccountName &&
entry.CustomerAccountInfo.CustomerAccountId == CustomerAccountId);
}
totalRecordsCount = totalRecords.Count();
Первый запрос работает полностью, но второй запрос выполняет только
var totalRecords = (from entry in invalidAccEntryRepository
select entry);
и игнорирует условно добавленное выражение where.
Кто-нибудь знает, в чем может быть проблема? Вам нужно больше информации?
Спасибо заранее!