Mapping Lists using Automapper

后端 未结 5 1618
挽巷
挽巷 2020-12-02 17:52

I have the classes:

public class Person{ /* Props here */ }

public class PersonViewModel { /* Props here */ }

Then the list:



        
5条回答
  •  失恋的感觉
    2020-12-02 18:46

    In core 1.1 this extension might work:

    public static List MapList(this IMapper mapper, List source)
            {
                return source.Select(x => mapper.Map(x)).ToList();
            }
    

提交回复
热议问题