Configure AutoMapper to map to concrete types but allow Interfaces in the definition of my class

前端 未结 1 672
死守一世寂寞
死守一世寂寞 2021-02-02 11:19

I have some code that is similar to what is below. Basically it represents getting data from a web service and converting it into client side objects.

void Main         


        
1条回答
  •  隐瞒了意图╮
    2021-02-02 12:00

    So I figured something that seems to work.

    If I add these two mappings:

    Mapper.CreateMap();
    Mapper.CreateMap().As(); 
    

    then it works as I want.

    I have not been able to find any documentation on the 'As' method (try googling for that! :), but it seems to be a mapping redirection.

    For example: For this Mapping (ISomething) resolve it As a Something.

    0 讨论(0)
提交回复
热议问题