Questions tagged [automapper-5]

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

106 questions
2
votes
1 answer

Automapper - Pluggable mapping

I need to implement a pluggable system where Automapper profiles can be provided by many DLL. The object to be mapped has a list of persons: public class CompanySrc { public List Persons {get;set;} } public class CompanyDest { …
Luca
  • 75
  • 7
2
votes
0 answers

Entity Framework Change Tracking And Automapper

Entity Framework classes: namespace ORM { public class Car { public int Id { get; set; } public string Name { get; set; } public int Price { get; set; } public virtual List Wheels { get; set; } …
ZingerCar
  • 33
  • 1
  • 7
2
votes
1 answer

How to initialize automapper in vb.net global.asax

I'm trying to initialize Automapper in Global.asax file using vb.net in ASP.NET API Version 2.0. I'm using Auto Mapper version 5.2. I can initialize using the C# code but I am not so sure about the VB.Net. After googling I've found something and…
user7336033
  • 271
  • 3
  • 16
2
votes
1 answer

Migrating to AutoMapper 5 - Circular references

I'm having a System.StackOverflowException when trying to Map something in AutoMapper 5 that worked previously with AutoMapper 4. After googling a bit around I found out that it caused by Circular references. The AutoMapper Documentation…
gsharp
  • 27,557
  • 22
  • 88
  • 134
2
votes
1 answer

Migrating to AutoMapper 5

I was using a AutoMapper 4.X as following (simplified snippet) Mapper.CreateMap() .ForMember(myB.MyProp, o => o.Foo()); // Foo is an extention method -> see below public static void Foo (this IMemberConfigurationExpression config) { …
gsharp
  • 27,557
  • 22
  • 88
  • 134
2
votes
1 answer

Automapper Map.CreateMap not used anymore?

I'm using version 5.1.1.0 of AutoMapper. Previously I was able to the following: Mapper.CreateMap(); But in the version 5.1.1.0 it doesn't exist anymore. Can anyone tell me what to do?
Bart Schelkens
  • 1,235
  • 4
  • 21
  • 45
2
votes
2 answers

Automapper - Assign Ranking in the Destination object

I am having the below source and destination objects: public class Source { public string Value1{ get; set; } } public class Destination { public string Value1{ get; set; } public int Ranking { get; set; } } I am trying to map…
Silly John
  • 1,584
  • 2
  • 16
  • 34
2
votes
2 answers

How to reuse ValueResolver across different mappings in AutoMapper 5?

I just tried upgrading AutoMapper to 5.0.2 but hit a road block. According to the migration docs, value resolvers have now access to the destination object: The signature of a value resolver has changed to allow access to the source/destination…
theDmi
  • 17,546
  • 6
  • 71
  • 138
1
vote
3 answers

AutoMapper 5.1 - Map Model and extended Model

I'm new with AutoMapper and i'm using 5.1.1 version. I tried to map a list of model with a list of extended model. I get empty object in return. My source model public class spt_detail { public string Name { get; set; } public string Age {…
Yannick
  • 13
  • 2
1
vote
0 answers

Expression 'dest => dest.Request.ID' must resolve to top-level member and not any child object's properties

I want to know why we will get this error and how to resolve it without creating seperating mapping for individual classes. I have two classes which I want to automap. I have followed the same approach for other two classes and it is being mapped…
1
vote
1 answer

Using enums as criteria in Automapper CreateMap and Projection

Using AutoMapper v6.1 Without having to hard code that value in lieu of the enum ((int)POStatusOptions.Ordered), how can you accomplish this map with Projection: CreateMap
crichavin
  • 4,672
  • 10
  • 50
  • 95
1
vote
1 answer

Automapper - map property to collection

Source classes: public class ApplicationDriverFormVM { public ApplicationDriverAddressFormVM PresentAddress { get; set; } public List PreviousAddresses { get; set; } } public class…
Oleg Sh
  • 8,496
  • 17
  • 89
  • 159
1
vote
1 answer

Automapper: map an anonymous/dynamic type

I need some help to map an anonymous object using Automapper. The goal is combine Product and Unity in a ProductDto (in which unity is a product's property). Autommaper CreateMissingTypeMaps configuration is set to true. My Classes: public class…
Douglas Gandini
  • 827
  • 10
  • 24
1
vote
2 answers

AutoMapper 5.2 No records when mapping

I am mapping with automapper 5.2 from Dto to Model and from Model to Dto. But the problem I have, that have 0 elements when I do the mapping. The two entities are the same. AutoMapperConfiguration.cs public class AutoMapperConfiguration { public…
ascariz
  • 13
  • 1
  • 4
1
vote
0 answers

Getting error when expanding navigation property that contains a nested navigation property

I'm building an OData service with Web API. Database access is handled via Entity Framework. I am mapping my EF entities to another set of classes using AutoMapper. Those mapped classes are what is being exposed via the OData service. I have a model…
Brian Ball
  • 12,268
  • 3
  • 40
  • 51