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.

Version 4.2.1.0 : Problem with ProjectTo

See original GitHub issue

I am using AutoMapper 4.2.1.0 to map an entity type into a DTO using ProjectTo .

I have created my Map like this :

var config = new MapperConfiguration(cfg =>
            {
                cfg.CreateMap<Order, OrderDTO>();
                cfg.CreateMap<Order_Detail, Order_DetailDTO>();
            });

and I am using config object like this :

var builder = config.ExpressionBuilder;
return ((IQueryable<Order>) property.GetValue(_db, null)).ProjectTo<OrderDTO>(builder);

but I am getting an error that says :

Missing map from Order to OrderDTO. Create using Mapper.CreateMap<Order, OrderDTO>.

Is there something that I do wrong ?

Here is the same question that I asked on SO: http://stackoverflow.com/questions/36450885/automapper-doesnt-work-as-it-should

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:2
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
TylerCarlson1commented, Apr 9, 2016

var ((IQueryable<TEntity>) property.GetValue(_db, null)).ProjectTo<TDto>(config); should work

Read more comments on GitHub >

github_iconTop Results From Across the Web

Automapper ProjectTo<>() issue when using NotMapped ...
I am getting the error only when I am using ProjectTo, I could not understand the underlying issue. (Automapper version am using 4.2.1.0) ......
Read more >
Troubleshoot .NET Framework targeting errors
To resolve the error, make sure that your application targets a .NET version that's compatible with the version that's targeted by the projects ......
Read more >
Code Generation Fail: An all the king's horses tragedy
Runtime, Version=4.2.1.0) when reflecting in T4 template in .NET Core 2.1 app. As always, I hope this has helped someone with a similar ......
Read more >
How to resolve .NET reference and NuGet package version ...
So now the problem arises for a single application. What to do when several of its projects depend on different version of the...
Read more >
PathSeqBuildReferenceTaxonomy – GATK
Build an annotated taxonomy datafile for a given microbe reference. The output file from this tool is required to run the PathSeq pipeline....
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