Can AutoMapper call a method on destination for each member of collection on source?
- by YonahW
I have two classes as below.
public class Destination
{
public Destination()
{
_StringCollection = new List<String>();
}
private ICollection<String> _StringCollection;
public IEnumerable<String> StringCollection
{
get
{
return _StringCollection.AsEnumerable<String>();
}
}
public void AddString(string str)
{
_StringCollection.Add(str);
}
}
public class Source
{
public List<String> StringCollection { get; set; }
}
I would like to map that for each member of source call AddString(member) on Destination.
I thought that maybe I could do something with a custom resolver but can't seem to figure out how.