Allow mapping of dynamic types using AutoMapper or similar?

前端 未结 4 1130
攒了一身酷
攒了一身酷 2020-12-02 05:46

I\'ve started to use https://github.com/robconery/massive for a project, I wonder if there is any mapping tool that allows support for Dynamic to static type mapping?

4条回答
  •  南方客
    南方客 (楼主)
    2020-12-02 06:25

    Single object:

    Mapper.Map(dynamicProduct);
    

    List:

    Mapper.Map>(dynamicListOfProducts);
    

    Example (line 71): https://github.com/AutoMapper/AutoMapper/blob/master/src/UnitTests/DynamicMapping.cs

提交回复
热议问题