Questions tagged [automapper-3]

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

This release was focussed on a separation for platform deployments, code comments and LINQ projection. Release blog and notes give further details.

128 questions
3
votes
1 answer

No mapping with AutoMapper with KeyValuePair

I'm building a generic pretty-print method. One of the special types that I want to handle separately is KeyValuePair. In order to reduce the object to a known type, I thought I would map each KeyValuePair to a KeyValuePair
Mau
  • 14,234
  • 2
  • 31
  • 52
3
votes
1 answer

Automapper: using Type Converter and Value Resolvers for the same types

I have a lots of DTOs that must be mapped to my domain's objects. In general, the mapping to monetary values need to apply a rounding rule. That's apply for more than 95% of the cases, but I have some data that need a different rounding rule. I…
Mario Fuentes
  • 31
  • 1
  • 2
3
votes
1 answer

Map only specific type with Automapper

public class Destination { public decimal Obj1 { set; get; } public decimal Obj2 { set; get; } public int Obj3 { set; get; } } public class Source { public decimal Obj1 { set; get; } public decimal Obj2 { set; get; } public…
Mironline
  • 2,755
  • 7
  • 35
  • 61
3
votes
2 answers

AutoMapper and DateTime to String mapping not working

I've been messing with AutoMapper for a few days now, but I am having the most difficult time mapping values for what to me seems like basic tasks. I'm most likely the dumb one, but it's starting to get really frustrating with all these constant…
Gup3rSuR4c
  • 9,145
  • 10
  • 68
  • 126
2
votes
1 answer

Automapper - map all properties except the one that does not exist in destination

Using Automapper 3 (upgrading is not an option), I am wondering how can I map an entity (src) to destination where the property in destination does NOT exist in source? Let's call the property in the destination some non mapped "temp" or…
Ahmed ilyas
  • 5,722
  • 8
  • 44
  • 72
2
votes
1 answer

AutoMapper: almost always trim strings

So, following the advice of this answer, I've set up a string to trimmed string map in my base AutoMapper (3.3.1) config, as: configuration.CreateMap().ConvertUsing(); Which works great, except for…
Glazius
  • 729
  • 7
  • 28
2
votes
2 answers

AutoMapper-ts mapped object is empty when I try to convert it to a type in TypeScript

I have the following class: class testClass { public text: string; } I create the following map using AutoMapper-ts: AutoMapper.createMap('source', 'dest') .convertToType(testClass); And then do my mapping: this.newObject =…
ViqMontana
  • 5,090
  • 3
  • 19
  • 54
2
votes
0 answers

Auto Mapper and EntityFramework Lazy Loading

I am running into an error when using AutoMapper with an EntityFramework class model. The error is: "The ObjectContext instance has been disposed and can no longer be used for operations that require a connection." I know that this is due to…
2
votes
1 answer

Automapper - efficient mapping & check mapping between two specific types

In my application I need to do many mappings (Domain objects, DTOs, ViewModels etc.) between different pair of objects. I use AutoMapper heavily for the purpose. So I have a common Mapper class which has methods to map different objects. As…
Arghya C
  • 9,805
  • 2
  • 47
  • 66
2
votes
0 answers

"Missing type map configuration or unsupported mapping" after deploying

Each time after I deploy my code into IIS I keep getting the error "Missing type map configuration or unsupported mapping". Once I restart IIS, the problem goes away, so I don't think it's my code. However, today, I am continuing to get this error.…
Andy T
  • 10,223
  • 5
  • 53
  • 95
2
votes
1 answer

Map dto to complex entity

How can I map the complex UploadDTO to the entity Number? public class UploadDTO { public CustomerDTO Customer { get; set; } public MachineDTO Machine { get; set; } public NumberDTO Number { get; set; } } public class Number { …
Pascal
  • 12,265
  • 25
  • 103
  • 195
2
votes
1 answer

Two way mapping with automapper using same objects and different TypeConverters

I want to use AutoMapper for mapping DTO s to Models. But my project contains some custom rules for default values for primitive types like [string null value is "_"], [default int value is -1] and [date time fields must be integer like 19990221]…
2
votes
1 answer

Inconsistent Mapping Behavior in AutoMapper 3

I've had issues with AutoMapper 3 mapping related entities from entity framework to a view model some of the time in MVC 5. I'm using EF 6.1.1 to get the data, and a thin and light repository layer to centralize queries. That issue only seems to…
ICodeForCoffee
  • 3,187
  • 2
  • 30
  • 40
2
votes
1 answer

Is it possible to automatically map all properties except a few complicated ones with AutoMapper?

I have some objects with a large number of properties. When I started using AutoMapper I was attempting to just map a few nested objects to understand how it works. All the time I thought it would map over properties with the same name at the source…
Brian Lyttle
  • 14,558
  • 15
  • 68
  • 104
2
votes
1 answer

How to map from ienumerable (or array) list property to list with AutoMapper?

I'm using AutoMapper in an attempt to simplify the responses from some REST API responses. I have an object with an array property called Messages, and I want to map it to a list<> or array in my client application. I've tried variations…
Brian Lyttle
  • 14,558
  • 15
  • 68
  • 104
1 2
3
8 9