I am new to Automapper, so I am not sure if this is possible.
I would like to map a class, but get it to ignore methods that are void. Below is an illustration of the code I have. When I run this I get the following exception message.
An unhandled exception of type 'AutoMapper.AutoMapperMappingException' occurred in AutoMapper.dll
Unfortunately it isn't an option to change the interface, so I assume if this is possible there is some sort of configuration I am missing?
public interface IThing
{
string Name { get; set; }
void IgnoreMe();
}
public class Foo : IThing
{
public string Name { get; set; }
public void IgnoreMe()
{
}
}
class Program
{
static void Main(string[] args)
{
var fooSource = new Foo {Name = "Bobby"};
Mapper.CreateMap<IThing, IThing>();
var fooDestination = Mapper.Map<IThing>(fooSource);
Console.WriteLine(fooDestination.Name);
Console.ReadLine();
}
}