-
-
Save jbogard/2898a35fefd1165b511642402c07a2d6 to your computer and use it in GitHub Desktop.
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 static class AutoMapperConfiguration | |
{ | |
public static MapperConfiguration Config { get; private set; } | |
public static void Configure() | |
{ | |
// Note below, you don't have to call AddProfile. You can call AddMaps, passing in Assembly object to search for Profiles | |
Config = new MapperConfiguration(cfg => { | |
/* list of assemblies to scan for profiles */ | |
cfg.AddProfile<ViewModelMaps.AdminViewModelMaps>(); | |
cfg.AddProfile<ViewModelMaps.OrderViewModelMaps>(); | |
cfg.AddProfile<ViewModelMaps.ITemViewModelMaps>(); | |
... | |
... | |
}); | |
Config.AssertConfigurationIsValid(); | |
} | |
public static Mapper GetMapper() | |
{ | |
return Config.CreateMapper(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment