Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
public class AutoMapperBootstrapper
private static readonly Lazy<AutoMapperBootstrapper> Bootstrapper = new Lazy<AutoMapperBootstrapper>(InternalInitialize);
public static void Initialize()
var bootstrapper = Bootstrapper.Value;
private AutoMapperBootstrapper()
private static AutoMapperBootstrapper InternalInitialize()
var profiles = typeof(AutoMapperBootstrapper)
.Where(type => type.IsSubclassOf(typeof(Profile)))
Mapper.Initialize(cfg =>
foreach (var profile in profiles)
return new AutoMapperBootstrapper();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.