Automapper, mapping IEnumearble<Foo> to IEnumearble<FooDto>
I ve been trying to do something like this:
...
Mapper.CreateMap<IEnumerable<Foo>, IEnumerable<FooDto>>();
var fooDtos = Mapper.Map<IEnumerable<Foo>, IEnumerable<FooDto>>(foos);
Keep in 开发者_JAVA百科mind that Foo is an entity but the properties are exactly the same that FooDto. The Result of fooDtos is an empty enumerable Tips?
ok Its simple I should have mapped like this :
Mapper.CreateMap<Foo, FooDto>();
and that works Doh!
精彩评论