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
1
vote
1 answer

Automapper-Map to a string

I tried creating a mapping to a string using the following CreateMap(): Mapper.CreateMap() .ConvertUsing(c => c.Name); But when I try to use this mapping, I get the following error: Type 'System.String' does not have a…
muttley91
  • 12,278
  • 33
  • 106
  • 160
1
vote
1 answer

How can I stop Automapper converting enum values into strings

Our code currently uses a very old version of Automapper (1.1) to the more recent 3.3. A change in automapper behaviour is causing some problems. We have fields of type object which may take values that are either reference types or enum values.…
Chris Fewtrell
  • 7,555
  • 8
  • 45
  • 63
1
vote
0 answers

Inheritance with automapper

There is an example in the Automapper documentation for inheritance as follows: public class Order { } public class OnlineOrder : Order { } public class MailOrder : Order { } public class OrderDto { } public class OnlineOrderDto : OrderDto {…
Turgrodan
  • 11
  • 4
1
vote
1 answer

AutoMapper inheritance error

I have the following abstract classes public abstract class BaseClass { public int NumberProperty { get; set; } } public abstract class BaseClass_DTO { public int NumberProperty { get; set; } public string NumberPropertyAsString { get;…
Lorenzo
  • 29,081
  • 49
  • 125
  • 222
1
vote
1 answer

Not able to map Dto to ViewModel

I am using latest version of AutoMapper. I have Mapper.CreateMap(); in my automapper bootstrapper class which is called in global.asax Here is the complete listing of same: public static class AutoMapperConfig { …
NoobDeveloper
  • 1,877
  • 6
  • 30
  • 55
1
vote
1 answer

AutoMapper Map DateTime to Object

I've recently changed how i get users to enter dates into my website. it used to be a text box and they type it in but after receiving feedback it seems people would prefer to have 3 drop downs as DD MM YYYY. I've added this into my website using…
Stephen E.
  • 252
  • 2
  • 17
1
vote
0 answers

AutoMapper "Member not found" with UseDestinationValue

I am trying to use AutoMapper to map a ViewModel to a Model. Here is my simplified ViewModel (the source) class: public class EditPaypointVM { public Int64 Id { get; set; } public Int64 OrganisationId { get; set; } …
CShark
  • 2,183
  • 1
  • 24
  • 42
1
vote
1 answer

AutoMapper - subObject stay null when mapping back to DTO from ViewModel

I have this map: Mapper.Initialize(cfg => { cfg.CreateMap().ReverseMap(); }); CadastroModule.Model.Cliente (MVVM MODEL): public class Cliente { public int ClienteID { get;…
Danilo Breda
  • 1,092
  • 1
  • 15
  • 30
1
vote
2 answers

AutoMapper: Max graph depth

I have the following entities which are connected with lists: Country -> Region -> Municipality -> Street When I map a Country object to my DTO, AutoMapper automatically projects my entire graph, all the way down to Streets, which is a great…
Anders Jakobsen
  • 995
  • 1
  • 10
  • 15
1
vote
0 answers

Multiple mappings for the same type (different rules)

I am using Automapper to map my domain model (nHibernate) to my view models and back. Everything is pretty smooth. Now I need to map an entity (domain entity) to itself cause I want to define some business rules there. I need to define different…
LeftyX
  • 35,328
  • 21
  • 132
  • 193
1
vote
0 answers

Restore < AutoMapper 3.1 null -> empty array behaviour

With AutoMapper <= 3.0, this following test passes. public class AutoMapperTest { static Source source; static Destination destination; Establish context = () => { Mapper.Configuration.AllowNullCollections = false; …
Darran
  • 593
  • 2
  • 13
1
vote
1 answer

Automapper with Column Order Data Annotation

I am having an issue on application start up when I setup my AutoMapper config. It is throwing an exception when creating the mapping for a business object to a data object. The issue appears to be coming from the use of data annotations. It is…
1
vote
1 answer

Automapper vs Value Injecter Performance and Flexiblitiy as of 2014

From Automapper and Value Injecter which one is the fastest, which one is the flexible one? as of 2014 (today) not the evaluation of the past
Mosby
  • 53
  • 1
  • 8
1
vote
3 answers

AutoMapper map object to Lookup field in MS Dynamics CRM

I am trying to map using AutoMapper. Source object is C# object public class Source { public string comment { get; set; } public string Subject { get; set; } public Account Account{ get; set; } } public…
1
vote
0 answers

Mapping from a flat domain object to a nested SOAP XML

I have an xml generated from a wsdl which is deeply nested with and contain a lot of field. The structure of the xml is in the form
damola
  • 282
  • 5
  • 18
1 2 3
8 9