Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

is there an AutoMapper merge function?

Tags:

automapper

AutoMapper Beginner Question: I was hoping AutoMapper would let me merge properties from a DTO back into an existing business object. I don't see anything like that. AutoMapper.Map() generates a new object and populates it, but I need to copy DTO changes back into the original business object. Is there an Map function that takes a source and target object?

like image 216
Chris Avatar asked Apr 01 '13 02:04

Chris


People also ask

When should you not use AutoMapper?

If you have to do complex mapping behavior, it might be better to avoid using AutoMapper for that scenario. Reverse mapping can get very complicated very quickly, and unless it's very simple, you can have business logic showing up in mapping configuration.

Is AutoMapper faster than manual mapping?

Automapper is considerably faster when mapping a List<T> of objects on . NET Core (It's still slower on full . NET Framework).

What can I use instead of AutoMapper?

AutoMapper is one of the popular object-object mapping libraries with over 296 million NuGet package downloads. It was first published in 2011 and its usage is growing ever since. Mapster is an emerging alternative to AutoMapper which was first published in 2015 and has over 7.4 million NuGet package downloads.

Can AutoMapper map collections?

AutoMapper supports polymorphic arrays and collections, such that derived source/destination types are used if found.


1 Answers

The Map method is overloaded. You can use Map(src, dst).

like image 125
Jacek Avatar answered Jan 23 '23 06:01

Jacek