Use this tag for version specific questions about AutoMapper 8 - the convention-based object-to-object mapper and transformer library for .NET. When using this tag also include the more generic [automapper] tag where possible.
Questions tagged [automapper-8]
24 questions
12
votes
1 answer
AddAutoMapper not found in .NET Core with AutoMapper
Using Visual Studio 2019 I installed AutoMapper version 8.1.0 via NuGet. When I try to add the services.AddAutoMapper() call though in my Startup.cs file I get a compiler error that the method doesn't exist.
I've already tried to do a dotnet clean…

Gargoyle
- 9,590
- 16
- 80
- 145
12
votes
1 answer
Automapper 8 - An expression tree lambda may not contain a null propagating operator
Automapper version 8.0.0 removed ResolveUsing extension method from IMappingExpression and consolidated it with MapFrom extension method. However, after replacing ResolveUsing with MapFrom method, certain configurations throw exception.
Original…

Nenad
- 24,809
- 11
- 75
- 93
5
votes
2 answers
AutoMapper 8 Upgrade ConstructUsing
I have just upgraded to v8 of AutoMapper and the expression below fails but I really cannot see why.
cfg.CreateMap()
.ConstructUsing(i => new Nmtoken(i))
.ForMember(m => m.Token, o => o.MapFrom(s => s));
I…

phil
- 1,938
- 4
- 23
- 33
2
votes
1 answer
Automapper ignore all mapping where value is null or default value
I'm using automapper via DI and want to have generic rules for all the mappings found in my solution. Belows example is of a single class, however I've got hundreds of classes to maintain and therefore want to add it to the mapper, not the mapping…

Mr Giggles
- 2,483
- 3
- 22
- 35
2
votes
1 answer
How to add global configuration options to Automapper v8 using instance api with .net core 2.2
I'm using:
.net core v2.2.0
Microsoft.EntityFrameworkCore v2.2.4
automapper v8.1.1
AutoMapper.Extensions.Microsoft.DependencyInjection v6.1.1
VS2017 Community Edition v15.9.12
In my solution i have:
TVC_DATA: handles all data access and contains…

skalma
- 23
- 4
2
votes
1 answer
Configuring AutoMapper in ASP.NET Core
I am trying to use automapper 8.0.0 to fill a list of WorkViewModel.
This list is getting data from the Work class out of the database using entity framework.
How ever it looks like something is going wrong with initializing as throwing follows…

Jeremie de Vos
- 174
- 1
- 11
2
votes
1 answer
Automapper Expression Mapping Issue
Expression mapping using AutoMapper.Extensions.Expression is not mapping the expression.
Here are my models:
public class UserDto
{
public int Id { get; set; }
public User User { get; set; }
//other info
}
public class User
{
public…

Sridhar
- 473
- 3
- 15
1
vote
1 answer
How to access .NET AutoMapper configuration access when using assembly scanning?
Can I get access to the AutoMapper configuration instance when using assembly scanning to register the profiles.
https://docs.automapper.org/en/latest/Dependency-injection.html
I had previously used ForAllMaps() to add a generic…

Josh Russo
- 3,080
- 2
- 41
- 62
1
vote
0 answers
Automapper ProjectTo DefaultIfEmpty Configuration?
AutoMapper v 8.1.1 / EF6
In this example, where Owner.CarId = null, OwnerDto.Car is also null. So if the default behavior is null on a nested property, is there a way to handle the equivalent of .DefaultIfEmpty(new CarDto()) in ProjectTo?
In using a…

crichavin
- 4,672
- 10
- 50
- 95
1
vote
0 answers
How to get list of all invalid/unmapped columns in automapper using c# with .net core 2.2?
I am using automapper to map two models. In my case I am importing XML file and binding it to model using automapper. I want to show error message to the user which will have all invalid columns/mappings so that user can change it in XML file and…

Shardul
- 309
- 1
- 3
- 17
1
vote
2 answers
Unmapped properties: _entityWrapper
Unmapped members were found. Review the types and members below.
Add a custom mapping expression, ignore, add a custom resolver, or modify the source/destination type
For no matching constructor, add a no-arg ctor, add optional arguments, or map all…

user6769842
- 27
- 5
1
vote
0 answers
No parameterless constructor defined for this object, automapper 8 and IValueResolver
I use AutoMapper 8 in a project and I want to make use of a resolver as shown below. The problem I got this message error:
MissingMethodException: No parameterless constructor defined for this
object.
and I don't know if I missing something…

David Létourneau
- 1,250
- 2
- 19
- 39
1
vote
1 answer
AutoMapper Expression Translation doesn't work
AutoMapper Expression Translation example from here
http://docs.automapper.org/en/stable/Expression-Translation-(UseAsDataSource).html doesn't work.
I have copied and paste (to make the example as simple as possible) example from AutoMapper site in…

unixqnx
- 21
- 2
0
votes
1 answer
EF Core related data is null with AutoMapper
In my app one case can have many companies.
My models:
public class Case
{
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public Guid Id { get; set; }
public string Name { get; set; }
public IList CaseCompanies {…

Mads
- 385
- 1
- 5
- 18
0
votes
1 answer
NullReferenceException using Where() in AutoMapper.MapFrom
I'm modelling a 3rd party database using Automapper 8 and EF 6.
One of my DTO classes needs to use a Where clause on an association to locate the correct record.
// Community table is mapped and working.
// Mapping breaks when mapping…

The Joker
- 403
- 7
- 15