tagged [automapper]

Where to validate AutoMapper Configuration in ASP.Net Core application?

Where to validate AutoMapper Configuration in ASP.Net Core application? Building an ASP.Net Core 2.0 web application and can't figure out where to validate the AutoMapper configuration. In my `Configu...

7 Oct at 19:21

Can Automapper be used in a console application?

Can Automapper be used in a console application? Is it possible to use [automapper](http://automapper.codeplex.com/) in a console application? Its [Getting Started Page](http://automapper.codeplex.com...

AutoMapper and convert a datetime to string

AutoMapper and convert a datetime to string I can't get my head round the following issue. I have a feeling it is a limitation of LINQ and expression trees, but not sure how to accept the lambda body....

19 Sep at 13:37

Can Automapper map a paged list?

Can Automapper map a paged list? I'd like to map a paged list of business objects to a paged list of view model objects using something like this: The paged list implementation is similar to Rob Coner...

15 Jan at 10:35

How to ignore all destination members, except the ones that are mapped?

How to ignore all destination members, except the ones that are mapped? Is there a way to do this? We have a SummaryDto that maps from three different types, and when we create a map for each type, pr...

29 Mar at 05:8

Automapper returning an empty collection, I want a null

Automapper returning an empty collection, I want a null If I map `Person` to `PersonModel` like so: If the `Addresses` property on

9 Feb at 13:32

Automapper: use source and destination together in mapping

Automapper: use source and destination together in mapping Is it possible, in Automapper, to concatenate the source with the destination when configuring a mapping of String properties? I thought I co...

12 Jan at 12:48

How can I map between two enums using Automapper?

How can I map between two enums using Automapper? I have a public facing interface that I'm trying to map two different enumerations to each other. I tried to use the following code: When that didn't ...

29 Jun at 16:48

AutoMapper.Map ignore all Null value properties from source object

AutoMapper.Map ignore all Null value properties from source object I'm trying to map 2 objects of the same type. What I want to do is AutoMapper to igonore all the properties, that have `Null` value i...

20 Sep at 13:49

AutoMapper Exclude Fields

AutoMapper Exclude Fields I'm trying to map one object to another but the object is quite complex. During development, I'd like the ability to either exclude a bunch of fields and get to them one by o...

16 Feb at 06:13

NuGet Package Manager: 'AutoMapper' already has a dependency defined for 'Microsoft.CSharp'

NuGet Package Manager: 'AutoMapper' already has a dependency defined for 'Microsoft.CSharp' I'm trying to add AutoMapper as a dependency to a project using NuGet on Visual Studio Premium 2012, but it ...

AutoMapper -- inheritance mapping not working, same source, multiple destinations

AutoMapper -- inheritance mapping not working, same source, multiple destinations Can I use inheritance mapping in AutoMapper (v2.2) for maps with the same Source type but different Destination types?...

How to Configure AutoMapper Once Per AppDomain

How to Configure AutoMapper Once Per AppDomain My current project with assemblies for the domain model, MVC web application, and unit tests. How can I set up the AutoMapper configuration so that all a...

29 Sep at 18:27

Copy object to object (with Automapper ?)

Copy object to object (with Automapper ?) I have a class: I have two instances of Person (person1 and person2). I'd like copy the contents of person2 to person1. I'd like to make this copy in one inst...

1 Nov at 00:13

Ignore a property in AutoMapper?

Ignore a property in AutoMapper? I'm using Automapper to copy one object properties to other and later will update in database using EF. Question is how to tell Automapper copy every property but igno...

5 Sep at 13:1

Automapper null properties

Automapper null properties I map my objects to dtos with Automapper. ``` public class OrderItem : BaseDomain { public virtual Version Version { get; set; } public virtual int Quantity { get; set; ...

30 Sep at 03:13

AutoMapper - why use Map over DynamicMap?

AutoMapper - why use Map over DynamicMap? the objects you're mapping with AutoMapper require no custom mappings, is there ever a point in doing this: If no custom mappings are required, does the above...

16 Mar at 15:50

Dictionary <string,string> map to an object using Automapper

Dictionary map to an object using Automapper I have a class like With a dictionary like Now i want to map `User` object to this `dictionary` usin

Usage of Automapper when property names are different

Usage of Automapper when property names are different We are using AutoMapper from Codeplex and for me the destination object has all the properties ending with 'Field', ie cityField and the source ob...

2 Feb at 17:28

AutoMapper with prefix

AutoMapper with prefix I'm trying to use Automapper to map to objects, the issue is one of the objects I'm trying to map has a prefix 'Cust_' in front of all its properties and one doesn't. Is there a...

23 Apr at 20:44

How to map nested child object properties in Automapper

How to map nested child object properties in Automapper I have current map: ``` CreateMap() .ForMember(dest => dest.BaseContentItem, opts => opts.MapFrom(src => src.BaseContentItem)) .ForMember(de...

31 Aug at 16:44

Automapper Object reference is required for the non static field, method or property

Automapper Object reference is required for the non static field, method or property I recently Upgraded my .net core to 3.0 and Automapper from 6.2 to 9.0. Now the automapper is throwing the followin...

11 Nov at 20:27

Mapping one source class to multiple derived classes with automapper

Mapping one source class to multiple derived classes with automapper Suppose i have a source class: And some destination classes: ``` public class DestinationBase { //Several properties } public cla...

5 Feb at 16:2

Where is the best place to map from view model to domain model?

Where is the best place to map from view model to domain model? Where is the best place to do mappings from view model to domain model? By mappings I mean from my `EditGrantApplicationViewModel` to a ...

Automapper: Ignore on condition of

Automapper: Ignore on condition of Is it possible to ignore mapping a member depending on the value of a source property? For example if we have: I'm looking for something like ``` Mapper.Creat

31 Aug at 18:49