Is it possible to map AddToClientCommand to List<AddToClient> ?
public class AddToClientCommand : IRequest<AddToClientResponse>
{
public List<int> AccountIds { get; set; }
public int ClientId { get; set; }
}
public class AddToClient
{
public int AccountId { get; set; }
public int ClientId { get; set; }
}
to achieve the following result:
var command = new AddToClientCommand
{
AccountIds = new List<int> { 1, 2 },
ClientId = 42
};
var result = // somehow automap with Automapper
var expected = new List<AddToClient>
{
new AddToClient { AccountId = 1, ClientId = 42 },
new AddToClient { AccountId = 2, ClientId = 42 }
};
expected.Should().BeEquivalentTo(result);


No need to use AutoMapper here. You can do what you want with a Linq query