Is there a way to map through a constructor while using a mappers for each of the parameters. For example if I have a dto
public class CreateBid
{
public int ClientId { get; set; }
public int RegulatoryBodyId {get;set;}
public string Descripption {get;set;
}
and command
public class CreateBidCommand
{
public CreateBidCommand(Client client,
RegulatoryBody regulatoryBody, string description)
{
Client = client;
RegulatoryBody = regulatoryBody;
Description = description;
}
public Client Client {get;}
public RegulatoryBody RegulatoryBody {get;}
public string Description {get;}
}
and I have setup automapping based on the suffix so that for example RegulatoryBodyId is mapped to instance RegualtoryBody,
I have all working if I make properties on my command public, which is not what I want.
What I want is for automapper to use constructor, and see that on source I have ClientId, in constructor I have a instance of Client, so use map to map int=>typeInstance. For all other members that are not in constructor use property mapping. Is this possible?
Just to re-iterate following works
_mapper.Map<int,Client>(112313);
or
_mapper.Map<string,SomeType>("someCode");
What I want is to apply this to every matching member in the constructor, based on the suffixes defined in the profile.
--
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-use...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
What do you mean? Intrigued.
To unsubscribe from this group and stop receiving emails from it, send an email to automapper-users+unsubscribe@googlegroups.com.