question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can't resolve this to Queryable Expression

See original GitHub issue

Hi,

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, ConcurrentDictionary2 typePairCount) at AutoMapper.QueryableExtensions.ExpressionBuilder.CreateMapExpression(ExpressionRequest request, Expression instanceParameter, ConcurrentDictionary2 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, ConcurrentDictionary2 typePairCount) at AutoMapper.QueryableExtensions.ExpressionBuilder.CreateMapExpression(ExpressionRequest request, Expression instanceParameter, ConcurrentDictionary2 typePairCount) at AutoMapper.QueryableExtensions.ExpressionBuilder.CreateMapExpression(ExpressionRequest request, ConcurrentDictionary2 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, ConcurrentDictionary2 typePairCount) at AutoMapper.QueryableExtensions.ExpressionBuilder.CreateMapExpression(ExpressionRequest request, Expression instanceParameter, ConcurrentDictionary2 typePairCount) at AutoMapper.QueryableExtensions.ExpressionBuilder.CreateMapExpression(ExpressionRequest request, ConcurrentDictionary2 typePairCount) at System.Collections.Concurrent.ConcurrentDictionary2.GetOrAdd(TKey key, Func2 valueFactory) at AutoMapper.QueryableExtensions.ExpressionBuilder.CreateMapExpression(Type sourceType, Type destinationType, IDictionary2 parameters, MemberInfo[] membersToExpand) at AutoMapper.QueryableExtensions.ProjectionExpression.To[TResult](IDictionary2 parameters, IEnumerable1 memberPathsToExpand) at AutoMapper.QueryableExtensions.Extensions.ProjectTo[TDestination](IQueryable source, IConfigurationProvider configuration, Expression1[] membersToExpand) at DB.Eus.GSC.Services.Repository.Services.BaseRepositoryService2.First(Expression1 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?

http://stackoverflow.com/questions/26806629/automapper-system-exception-cant-resolve-this-to-queryable-expression

Does ProjectTo<T> work with ResolveUsing?

Thanks in advance Pete

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
jbogardcommented, Feb 22, 2016

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.

0reactions
lock[bot]commented, May 5, 2019

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Automapper ResolveUsing cause "Can't resolve this to ...
I think what your issue is that you're trying to call . NET code in the query to the database which is erroring....
Read more >
C# – Automapper ResolveUsing cause “Can't resolve this ...
I'm using autommaper to map domain classes to model classes and viceversa. I need to encrypt/decrypt one property. When I map Model to...
Read more >
C# : Automapper ResolveUsing cause "Can't resolve this to ...
C# : Automapper ResolveUsing cause "Can't resolve this to Queryable Expression" To Access My Live Chat Page, On Google, Search for "hows tech...
Read more >
Queryable Extensions
If the expression is rejected from your query provider (Entity Framework, NHibernate, etc.), you might need to tweak your expression until you find...
Read more >
Invalidoperationexception: the LINQ expression
Hi, I have the message System.InvalidOperationException: The LINQ expression 'DbSet<Developer>() .Where(d => d.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found