Can't resolve this to Queryable Expression
See original GitHub issueHi,
I have just implemented the latest version of AutoMapper and have moved away from the static API and have implemented the ProjectTo<T> extensions as well.
I am now getting the below error, which I wasn’t before
Can’t resolve this to Queryable Expression
at AutoMapper.QueryableExtensions.ExpressionBuilder.ResolveExpression(PropertyMap propertyMap, Type currentType, Expression instanceParameter) at AutoMapper.QueryableExtensions.ExpressionBuilder.CreateMemberBindings(ExpressionRequest request, TypeMap typeMap, Expression instanceParameter, ConcurrentDictionary
2 typePairCount) at AutoMapper.QueryableExtensions.ExpressionBuilder.CreateMapExpression(ExpressionRequest request, Expression instanceParameter, ConcurrentDictionary
2 typePairCount) at AutoMapper.QueryableExtensions.Impl.MappedTypeExpressionBinder.BindMappedTypeExpression(IConfigurationProvider configuration, PropertyMap propertyMap, ExpressionRequest request, ExpressionResolutionResult result, ConcurrentDictionary2 typePairCount) at AutoMapper.QueryableExtensions.ExpressionBuilder.CreateMemberBindings(ExpressionRequest request, TypeMap typeMap, Expression instanceParameter, ConcurrentDictionary
2 typePairCount) at AutoMapper.QueryableExtensions.ExpressionBuilder.CreateMapExpression(ExpressionRequest request, Expression instanceParameter, ConcurrentDictionary2 typePairCount) at AutoMapper.QueryableExtensions.ExpressionBuilder.CreateMapExpression(ExpressionRequest request, ConcurrentDictionary
2 typePairCount) at AutoMapper.QueryableExtensions.Impl.EnumerableExpressionBinder.BindEnumerableExpression(IConfigurationProvider configuration, PropertyMap propertyMap, ExpressionRequest request, ExpressionResolutionResult result, ConcurrentDictionary2 typePairCount) at AutoMapper.QueryableExtensions.ExpressionBuilder.CreateMemberBindings(ExpressionRequest request, TypeMap typeMap, Expression instanceParameter, ConcurrentDictionary
2 typePairCount) at AutoMapper.QueryableExtensions.ExpressionBuilder.CreateMapExpression(ExpressionRequest request, Expression instanceParameter, ConcurrentDictionary2 typePairCount) at AutoMapper.QueryableExtensions.ExpressionBuilder.CreateMapExpression(ExpressionRequest request, ConcurrentDictionary
2 typePairCount) at System.Collections.Concurrent.ConcurrentDictionary2.GetOrAdd(TKey key, Func
2 valueFactory) at AutoMapper.QueryableExtensions.ExpressionBuilder.CreateMapExpression(Type sourceType, Type destinationType, IDictionary2 parameters, MemberInfo[] membersToExpand) at AutoMapper.QueryableExtensions.ProjectionExpression.To[TResult](IDictionary
2 parameters, IEnumerable1 memberPathsToExpand) at AutoMapper.QueryableExtensions.Extensions.ProjectTo[TDestination](IQueryable source, IConfigurationProvider configuration, Expression
1[] membersToExpand) at DB.Eus.GSC.Services.Repository.Services.BaseRepositoryService2.First(Expression
1 where, IConfigurationProvider config, Expression`1[] includeProperties) in d:\Source\GSC\DB.Eus.GSC.Services\trunk\DB.Eus.GSC.Services\Repository\Services\BaseRepositoryService.cs:line 296_
In my create map I am using a custom IValueResolver(s) which may return nullable DateTime.
Is it in any way related to this issue? https://github.com/AutoMapper/AutoMapper/issues/1123
or this issue?
Does ProjectTo<T> work with ResolveUsing?
Thanks in advance Pete
Issue Analytics
- State:
- Created 8 years ago
- Comments:10 (5 by maintainers)
Top GitHub Comments
Use MapFrom. Entity Framework can never and will never recognize any random Func, you have to supply it with an Expression, so use MapFrom. Not any custom value resolver (no query provider would know what to do with one), or any of the func-based extensions. Just expressions.
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.