Questions tagged [automapper-6]

Use this tag for version specific questions about AutoMapper 6 - 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.

117 questions
1
vote
1 answer

AutoMapper: class properties, map ISet to HashSet
I have defined a mapping to/from my DTO object, the properties on one versus the other match excatly except that the DTO Object has collections defined as ISet and the non DTO object has those collectiond defined as HashSet . I've noticed a…
Greg Mone
  • 11
  • 5
1
vote
0 answers

AutoMapper not calling AfterMap when mapping a dynamic proxy

Let's say I've designed a class A and also I've designed a DTO class called Dto. If A is a dynamic proxy generated with Castle DynamicProxy, AutoMapper won't fire AfterMap: mappingConfig.CreateMap() .AfterMap ( (dto, a,…
Matías Fidemraizer
  • 63,804
  • 18
  • 124
  • 206
0
votes
1 answer

Mapping objects with a field that is another class

I am mapping an object to an object model as shown below: CreateMap() .ForMember(result => result.OrderId, opt => opt.MapFrom(source => source.OrderId)) …
HoboJeff
  • 101
  • 1
  • 1
  • 8
0
votes
1 answer

Can I specify a default mapping source for unmapped members with AutoMapper?

I have a type that encapsulates a bunch of related data class CollectionNoteDetails { CollectionNote Note {get;set;} Customer SourceCustomer {get;set;} Customer DestinationCustomer {get;set;} Haulier Haulier{ get;set;} } and I want…
Greg B
  • 14,597
  • 18
  • 87
  • 141
0
votes
1 answer

Unable to map byte[] or byte[]? (nullable byte[]) using AutoMapper ForCtorParam function

Unable to map byte[] or byte[]? (nullable byte[]) using AutoMapper ForCtorParam function, I am getting below error message AutoMapper.AutoMapperConfigurationException : Unmapped members were found. Review the types and members below. Add a custom…
0
votes
0 answers

AutoMapper nested Collection without setter Globally

We have been using AutoMapper since some time now. We were trying to update the AutoMapper version and some things started to fail. Wherever Lists were defined with Private Setter the mapper silently fails and the List turns out Empty. I tried…
pratikvasa
  • 1,897
  • 20
  • 24
0
votes
1 answer

Should I return result of AutoMapper using await Task.FromResult() in an async method?

All my repository methods are async for my CRUD operations using EF.Core async methods and use AutoMapper to map my EF entity model (Customer) to Domain Model (CustomerModel) and pass it back to my service layer. public async Task
MedEzz
  • 1
0
votes
1 answer

Mapping "long" to create an object

iam trying to map just a long field coming from my url route to create a Query Object from my controller, can i use auto mapper CreateMap(MemberList.None); Source :-long id Destination:- public class GetPlanQuery : IRequest
Kod
  • 189
  • 1
  • 3
  • 13
0
votes
1 answer

How can I create new fields with AutoMapper?

I want to create new fields and replace others when I map objects in C #, as I show below public class one { public int a {get; set;} public int b {get; set;} public int c {get; set;} } public class two { public int sum {get; set;}…
0
votes
1 answer

Issue with returning mapped properties (.Net Core + Automapper Extensions 6.1)

Have Input model and Output model. Both contain a property - collection of AddressModel. After mapping - the returned result only contains values for AddressModel values, while main Output properties are blank (null). What am I doing…
Nat
  • 630
  • 1
  • 5
  • 17
0
votes
1 answer

Automapper 8 mapping not working properly

I have two model classes, when I try to map different properties of different name by using Automapper ForMember method. It throws an automapper configuration validation exception on the mapping of different property. I have tried a lot but It does…
user3661407
  • 525
  • 3
  • 9
  • 18
0
votes
0 answers

Automapper not finding type map configuration for child property

I'm using AutoMapper 6.1.1.0 and have the following types: Source: public class PaymentPlan { private List _scheduledPayments = new List(); private Rates _ratesApplied; public Rates RatesApplied …
xr280xr
  • 12,621
  • 7
  • 81
  • 125
0
votes
1 answer

AutoMapper not automatically copying Id column of same name

AutoMapper 7.0.1 Found an interesting issue that I couldn't explain. When mapping the view model back to the DB entity object, the Id property is not mapped and is always 0, unless I explicitly set its MapFrom in the CreateMap definition. In the…
crichavin
  • 4,672
  • 10
  • 50
  • 95
0
votes
0 answers

How can I call an extension method during mapping against all source members that have a custom attribute?

I'm using AutoMapper v6.1.1 to map from my rich domain model entities to some flattened DTOs. I'm initialising the configuration in a static class that returns an IMapper, which adds our mapping profiles and configures PreserveReferences() for all…
Sir Crispalot
  • 4,792
  • 1
  • 39
  • 64
0
votes
1 answer

Automapper - Conditional mapping for both IQueryable extensions and in-memory

I have classes EntityA to DtoA and 2 usages of automapper in my .NET project. First one is: var result1 = dbContext .Set() .Where(...) .ProjectTo(new { param1 = true } ) .ToList(); And the second: var aList =…
Andrey Pesoshin
  • 1,136
  • 1
  • 14
  • 30