Created
July 17, 2015 14:51
-
-
Save komainu85/4079e0a0a34172dc8888 to your computer and use it in GitHub Desktop.
Automapper Adapter Pattern
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Mapper : IMapper | |
{ | |
public T Map<S, T>(S source) | |
{ | |
AutoMapper.Mapper.CreateMap<S, T>(); | |
T result = AutoMapper.Mapper.Map<S, T>(source); | |
return result; | |
} | |
public List<T> MapList<S, T>(List<S> source) | |
{ | |
AutoMapper.Mapper.CreateMap<S, T>(); | |
List<T> result = AutoMapper.Mapper.Map<List<S>, List<T>>(source); | |
return result; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment