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
5
votes
2 answers

Denormalise object hierarchy with automapper

I know various questions have been asked that resembles this question, but as far as I can tell (and test), none of the provided solutions seems to fit, so here goes. I am wondering if it is possible to flatten/denormalise an object hierarchy so…
Esben Bach
  • 664
  • 4
  • 23
5
votes
2 answers

Automapper causing error: missing type map configuration or unsupported mapping

I am new to Automapper. I have added Nuget package - Automapper into my Manager (BLL) and DAL layer. Now, below is related stuff: Below is the statment of Manager library that giving me…
user3711357
  • 1,425
  • 7
  • 32
  • 54
5
votes
2 answers

Automapper map from Source to Destination containing List of Objects

I have to create a Mapping with automapper. Public class Source { public string Id; public string Firstname; public string Lastname; } Destination is Public class Destination { public string Id; public Person[]…
user2739679
  • 827
  • 4
  • 14
  • 24
5
votes
0 answers

Automapper and a collection of objects with reference to parent object

It's probably easiest if I explain this with a (fictitious) example. I have an nHibernate model that contains an Order object. This Order object contains a collection of OrderItem nHibernate objects. I have an Order ViewModel which contains a…
Dave
  • 1,068
  • 12
  • 26
4
votes
1 answer

Automapper and Autofac

I am trying to get Automapper to play nice with Autofac in an ASP.Net MVC application. I have followed the instructions in the answer to this: Autofac 3 and Automapper However it fails on the first call to _mapper.Map<>(...) Autofac is setup like…
punkologist
  • 721
  • 5
  • 14
4
votes
2 answers

AutoMapper Conditional Entity Mapping

I have a db entity which stores the Order Addresses like this... And I have the BLL classes like this... public class DeliveryAddress { public string Id { get; set; } public string PersonyName { get; set; } public string CompanyName {…
Naveed Butt
  • 2,861
  • 6
  • 32
  • 55
4
votes
2 answers

AutoMapper: two-way, deep mapping, between domain models and viewmodels

I need to map two ways between a flat ViewModel and a deep structured Domain model. This will be a common scenario in our solution. My models are: public class Client { ... public NotificationSettings NotificationSettings { get; set; } …
Brendan Hill
  • 3,406
  • 4
  • 32
  • 61
4
votes
1 answer

AutoMapper null source value and custom type converter, fails to map?

When using a custom type converter (ITypeConverter) with AutoMapper it does not seem to enter the type converters code if the source value is null, e.g: Mapper.CreateMap().ConvertUsing(); Assert.AreEqual(Enum.Value1,…
Hux
  • 3,102
  • 1
  • 26
  • 33
4
votes
1 answer

Automapper unflatten with prefix

I have some DTOs which are mapped from Domain objects thanks to convention-based automapping, i.e. the Address fields are being flattened to the DTO. This works fine for Domain -> DTO conversion, but the other way I have to "unflatten" the Address…
migajek
  • 8,524
  • 15
  • 77
  • 116
4
votes
1 answer

Unit testing with AutoMapper using DeploymentItem attribute not working - PlatformNotSupportedException

I'm trying to use AutoMapper with my unit tests that use DeploymentItem attributes in order to read files at runtime. Here is my code: [TestClass] public class UnitTest1 { [TestMethod] …
Javier Capello
  • 745
  • 4
  • 13
4
votes
2 answers

How to map Integer to String with AutoMapper 3 and Entity Framework

I am trying to use AutoMapper 3 to project a class with an Integer property to another class with a String property. When the query is executed then I get the following exception: System.NotSupportedException: LINQ to Entities does not recognize the…
Elie
  • 1,140
  • 2
  • 9
  • 16
3
votes
1 answer

Mapping complex DTOs to entities with automapper

I want to map from LDTTicketUploadDTO[] to IEnumerable The mappings are created in this method and at the end I map the data. public void UploadLDTTickets(LDTTicketUploadDTO[] ticketDTOs) { …
Pascal
  • 12,265
  • 25
  • 103
  • 195
3
votes
1 answer

Map COM object with automapper

I'm having an issue mapping from a COM object to an object. I believe the problem is that GetType() on the COM object returns System.__ComObject. How can I get around this? Missing type map configuration or unsupported mapping. Mapping…
The Muffin Man
  • 19,585
  • 30
  • 119
  • 191
3
votes
0 answers

Automapper - read properties with underscore as nested object

for example I have DB view that returns these columns: Id int Name nvarchar(200) PrimaryAddress_Street nvarchar(200) PrimaryAddress_City nvarchar(200) And I would like to map it to my DTO: public class Customer { public int Id { get; set; } …
3
votes
1 answer

AutoMapper Change Type

Given the following: var object1 = new A() { Equipment = new List() { new FooEquipment() } }; var object2 = new B() { Equipment = new List() { new FooEquipment() } ); var list = new List() { object1, object2…
Sebastian Patten
  • 7,157
  • 4
  • 45
  • 51
1
2
3
8 9