Can AutoMapper call a method on destination for each member of collection on source?
Posted
by YonahW
on Stack Overflow
See other posts from Stack Overflow
or by YonahW
Published on 2010-04-09T16:10:49Z
Indexed on
2010/04/09
16:13 UTC
Read the original article
Hit count: 271
automapper
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.
© Stack Overflow or respective owner