Skip to content

Instantly share code, notes, and snippets.

@jbogard
Created July 20, 2016 14:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jbogard/ac5d48395d6d547fed392244282719be to your computer and use it in GitHub Desktop.
Save jbogard/ac5d48395d6d547fed392244282719be to your computer and use it in GitHub Desktop.
public static void AddAutoMapper(this IServiceCollection services)
{
services.AddAutoMapper(DependencyContext.Default);
}
public static void AddAutoMapper(this IServiceCollection services, DependencyContext dependencyContext)
{
services.AddAutoMapper(dependencyContext.RuntimeLibraries
.SelectMany(lib => lib.GetDefaultAssemblyNames(dependencyContext).Select(Assembly.Load)));
}
@SuperJMN
Copy link

SuperJMN commented Nov 29, 2017

I think the line 9 should call Initalize.AddAutoMapperClasses instead! Am I wrong? You're passing it a IEnumerable<Assembly>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment