когда я использовал EF 2.2, он без проблем переносит этот код:
var resource = locResRepo.GetWhere(i => i.ForApplication.ToLower() == applicationName.ToLower())
.Where(resourcesConditionExpression)
.Select(item => new ResourceKeyObject
{
Id = item.Id,
ResourceKey = item.ResourceKey,
ResourceKeyValues = item.ActualLocalizationTranslation
.Where(translationConditionExpression)
.Select(v => new ResourceKeyValues
{
Language = v.Language,
KeyValue = v.Value
}).ToList()
}).ToList();
Но теперь выдает ошибку:
System.InvalidOperationException: Processing of the LINQ expression '(MaterializeCollectionNavigation(
navigation: Navigation: LocalizationResources.ActualLocalizationTranslation,
subquery: (NavigationExpansionExpression
Source: DbSet<ActualLocalizationTranslation>
.Where(a => EF.Property<Nullable<int>>(l, "Id") != null && EF.Property<Nullable<int>>(l, "Id") == EF.Property<Nullable<int>>(a, "ResourceId"))
PendingSelector: a => (NavigationTreeExpression
Value: (EntityReference: ActualLocalizationTranslation)
Expression: a)
)
.Where(i => EF.Property<Nullable<int>>((NavigationTreeExpression
Value: (EntityReference: LocalizationResources)
Expression: l), "Id") != null && EF.Property<Nullable<int>>((NavigationTreeExpression
Value: (EntityReference: LocalizationResources)
Expression: l), "Id") == EF.Property<Nullable<int>>(i, "ResourceId")))
.Where(t => True)' by 'NavigationExpandingExpressionVisitor' failed. This may indicate either a bug or a limitation in EF Core. See https://go.microsoft.com/fwlink/?linkid=2101433 for more detailed information.
at Microsoft.EntityFrameworkCore.Query.Internal.NavigationExpandingExpressionVisitor.VisitMethodCall(MethodCallExpression methodCallExpression)
at System.Linq.Expressions.MethodCallExpression.Accept(ExpressionVisitor visitor) and so on.....
И я действительно не могу понять, почему .. Или может я что-то знаю, но не знаю, как это реализовать