How to map multiple list to a single list?

24 views
Skip to first unread message

sudama90...@gmail.com

unread,
Nov 30, 2016, 12:16:55 AM11/30/16
to AutoMapper-users
I have few classes and they have multiple list items like below:

public class Request1
{
   public List<AdditionalApplicantData> AdditionalApplicantData { get; set;}

   public List<ApplicantData> ApplicantData { get; set; }
}

public class Request2 
{
  public List<ApplicantDetails> ApplicantData { get; set; }
}

I want to map Request1 to Request2 but List of ApplicantData has to be mapped from multiple sources like List of ApplicantData 
& List of ApplicantData but not sure how to achieve it can someone please help me here?

Thanks in Advance :
Sudama

Jimmy Bogard

unread,
Nov 30, 2016, 1:19:54 PM11/30/16
to automapper-users
Do your list item types have mapping? If so, you can do:

ForMember(d => d.ApplicantData, opt => opt.MapFrom(src => src.ApplicantData.Append(src.AdditionalApplicantData)))

--
You received this message because you are subscribed to the Google Groups "AutoMapper-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to automapper-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages