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.

Problem with the Automapper

See original GitHub issue

Trying to return the data from server but end up in error with autoMapper but the datatype and the mapping correct and simple.


code to return the data to the angular controller call :

public ListResultDto<CapacityListDto> GetCapacity(GetCapacityInput input)

    {

        var capacity = new Capacity

        {

            City = input.City,

            Center = input.Center,

            Housing = input.Housing

        };



     return new ListResultDto<CapacityListDto>(capacity.MapTo<List<CapacityListDto>>());



    }

Error :

{“\nUnmapped members were found. Review the types and members below.\nAdd a custom mapping expression, ignore, add a custom resolver, or modify the source/destination type\nFor no matching constructor, add a no-arg ctor, add optional arguments, or map all of the constructor parameters\n==========================================================================================================================================================================\r\nAutoMapper created this type map for you, but your types cannot be mapped using the current configuration.\r\nCapacity -> List1 (Destination member list)\r\nISAS.Automate.Capacity -> System.Collections.Generic.List1[[ISAS.Automate.Dto.CapacityListDto, ISAS.Application, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]] (Destination member list)\r\n\r\nUnmapped properties:\r\nCapacity\r\n”}

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
acjhcommented, Aug 25, 2018
var items = new List<CapacityListDto> { _objectMapper.Map<CapacityListDto>(capacity) };
return new ListResultDto<CapacityListDto>(items);
0reactions
Gardens18commented, Aug 26, 2018

Thank you.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Is using automapper bad? : r/csharp
Automapper is a good tool that people over use. Personally I think its good in large projects where the performance trade offs are...
Read more >
AutoMapper considered harmful
Poor code navigation experience. If your objects are mapped with default Automapper config, you cannot find where a field takes its value.
Read more >
AutoMapper considered harmful | anthonysteele.github.io
This common idea is IMHO not just wrong (using AutoMapper is a choice), it is harmful. There are pros and cons to every...
Read more >
Pitfalls of AutoMapper - Gigi Labs - Daniel D'Agostino
The biggest problems I've seen with the use of AutoMapper relate to when certain properties are computed based on external dependencies, ...
Read more >
An issue with AutoMapper in ASP.Net Core
Ok, I've managed to solve the problem, it had nothing to do with the code above. Just passed the wrong assembly to the...
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