Skip to content

Instantly share code, notes, and snippets.

@takahirohonda
Last active December 16, 2019 09:26
Show Gist options
  • Save takahirohonda/1d7b957ac462c4345c0fb0b7dbac2a69 to your computer and use it in GitHub Desktop.
Save takahirohonda/1d7b957ac462c4345c0fb0b7dbac2a69 to your computer and use it in GitHub Desktop.
Startup - ASP.NET DI Out of the box way
public void ConfigureServices(IServiceCollection services)
{
// Add dependencies manually
services.AddScoped(typeof(IAppLogger<>), typeof(LoggerAdapter<>));
services.AddScoped(typeof(IEfRepository<>), typeof(EfRepository<>));
services.AddScoped<IAppsRepository, AppsRepository>();
services.AddScoped<IAppReviewRepository, AppReviewRepository>();
services.AddScoped<IAppCategoryRespository, AppCategoryRespository>();
...
services.AddMvc()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment