Следующий запрос без ошибок работает с поставщиками SqlServer и PostgreSQL:
Код: Выделить всё
IEnumerable listStringValues = listStringValues.Where ( x => x != null ).Select ( x => x.ToUpper () );
var query = _ctx.Invoices.Where ( x => ( x.FormatType.FormatTypeCode == FormatTypeCode.ER ||
x.FormatType.FormatTypeCode == FormatTypeCode.AR ||
x.FormatType.FormatTypeCode == FormatTypeCode.EA ||
x.FormatType.FormatTypeCode == FormatTypeCode.AA ) &&
listStringValues.Any ( y => y.Contains ( x.ExternalNumber.ToUpper () ) ) );
Код: Выделить всё
The LINQ expression '[Microsoft.EntityFrameworkCore.Query.ParameterQueryRootExpression]' could not be translated. Additional information: Primitive collections support has not been enabled. Either rewrite the query in a form that can be translated, or switch to client evaluation explicitly by inserting a call to 'AsEnumerable', 'AsAsyncEnumerable', 'ToList', or 'ToListAsync'. See https://go.microsoft.com/fwlink/?linkid=2101038 for more information.Заранее благодарим за помощь!
С уважением
SB
Я пытался разделить запрос, а также попробовал сначала загрузить все счета и выполнить фильтр через Содержит через LinqToObjects, и это сработало!
Я пытался разделить запрос, а также попробовал сначала загрузить все счета-фактуры и выполнить фильтр через Содержит через LinqToObjects, и это сработало!
>
Подробнее здесь: https://stackoverflow.com/questions/788 ... ery-failed
Мобильная версия