Questions tagged [automapper-2]

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

113 questions
0
votes
1 answer

How do I map from a source property to the destination?

I swear I've done it before, but I can't seem to get it to work now. Basically I'm getting an EndUser containing a Site, and I want to map that Site to a SiteInfo object. Here's my map configuration: Mapper.CreateMap() …
CodeRedick
  • 7,346
  • 7
  • 46
  • 72
0
votes
0 answers

Dynamically build map at runtime using xml?

I have an XML file that defines a map for an object -- it basically tells me to map: A -> _a B -> _b C -> SomeFunction(_d) I'd like to parse this at runtime (easy enough) and then somehow initialize an automapper map for this.. I've tried a few…
XeroxDucati
  • 5,130
  • 2
  • 37
  • 66
0
votes
1 answer

Why do I get odd AutoMapped results if I map directly from IEnumerable to IEnumerable?

I am having a strange issue with AutoMapper. If I do the following //Get my entities from EF repository var movements = _movementRepository.AllIncluding(movement => movement.Asset, movement => movement.Job,movement =>…
GraemeMiller
  • 11,973
  • 8
  • 57
  • 111
0
votes
1 answer

Unmapped field on destination is set to null

I am using Automapper for mapping two objects. I have field VehicleModel in the destination which has some default value. I don't have a mapping for this destination field in the source. So I didn't map it. After mapping is done, my default value is…
0
votes
2 answers

Automapper with NHibernate - How to persist mapped objects?

I have an ASP.NET MVC application that uses Fluent NHibernate and AutoMapper. I am primarily using AutoMapper to map my Models to ViewModels and vice versa. When doing the latter, mapping from my viewmodel back to a model, I am wondering how I can…
0
votes
1 answer

Mapping multiple collections to a single collection using Automapper

I am able to map group of sametype of collections to a single collection using the below code. AutoMapper.Mapper.CreateMap().ForMember( dest => dest.Drivers, opt => opt.MapFrom(src =>…
0
votes
1 answer

Collection overriding when mapping two collections of same type using Automapper

I have my classes defined as below Source { public List UnreportedDrivers { get; set; } // count 1 public List LendingLossDrivers { get; set; } // count 2 public List OtherDrivers { get; set; } // count…
-1
votes
1 answer

Automapper flatten with derived type properties

I'm using an automapper to flatten the object coming from WS. Simplified model would be as follows: public abstract class AOrder { public Product Product {get;set;} public decimal Amount {get;set;} //number of other properties } public…
Alex M
  • 2,410
  • 1
  • 24
  • 37
1 2 3 4 5 6 7
8