I have an interface that describes two objects. One is a DAO, the other is a BO. So, here's what it looks like:
public interface IOrder ...
public class OrderDAO : IOrder ...
public class OrderBO : IOrder ...
And I would like to map OrderDAO to OrderBO. My original line of thought was that I could simply map interface to interface and supply both concrete objects, like so:
AutoMapper.Mapper.Map<IOrder, IOrder>(myOrderDAO, myOrderBO);
However, this did not work out-of-the-box. I still had to create a map in order to get the data from myOrderDAO to myOrderBO.
AutoMapper.Mapper.CreateMap<IOrder, IOrder>();
I'm not sure that makes a lot of sense to me and I feel like I'm "doing it wrong", as it were. So my question is two-fold.
- What is the best way to map in the above scenario?
- Why would I need to create a map for the same interface?
Thanks in advanced.