Wie registriere ich AutoMapper 4.2.0 mit Simple Injector?

Auf AutoMapper 4.2.0 aktualisiert und den hier verfügbaren Migrationsleitfaden befolgend:https: //github.com/AutoMapper/AutoMapper/wiki/Migrating-from-static-API/f4784dac61b91a0df130e252c91a0efd76ff51de#preserving-static-fee. Versucht, Code auf dieser Seite für StructureMap in Simple Injector zu übersetzen. Kann mir jemand zeigen, wie dieser Code in Simple Injector aussieht?

StructureMap

public class AutoMapperRegistry : Registry
{
    public AutoMapperRegistry()
    {
        var profiles =
            from t in typeof (AutoMapperRegistry).Assembly.GetTypes()
            where typeof (Profile).IsAssignableFrom(t)
            select (Profile)Activator.CreateInstance(t);

        var config = new MapperConfiguration(cfg =>
        {
            foreach (var profile in profiles)
            {
                cfg.AddProfile(profile);
            }
        });

        For<MapperConfiguration>().Use(config);
        For<IMapper>().Use(ctx => ctx.GetInstance<MapperConfiguration>().CreateMapper(ctx.GetInstance));
    }
}

Simple Injector

?

Antworten auf die Frage(6)

Ihre Antwort auf die Frage