Do i need to create automapper createmap both ways?

后端 未结 4 1472
情深已故
情深已故 2021-02-05 00:08

This might be a stupid question! (n00b to AutoMapper and time-short!)

I want to use AutoMapper to map from EF4 entities to ViewModel classes.

1) If I call

<
4条回答
  •  半阙折子戏
    2021-02-05 00:38

    I've used an extension method do mapping both ways

        public static IMappingExpression BothWays
            (this IMappingExpression mappingExpression)
        {
            return Mapper.CreateMap();
        }
    

    usage:

     CreateMap().BothWays();
    

提交回复
热议问题