Lightweight, fast and convenient dependencies installer for ASP.NET Core
Replace huge piles of similar code for dependencies registration with one single line.
public void ConfigureServices(IServiceCollection services)
{
services.AddMvc(
config => {
config.Filters.Add(typeof(ExceptionFilter));
}
);
services.AddDbContext<DataContext>(
options => options.UseSqlServer(Configuration.GetConnectionString("DefaultConnection")), ServiceLifetime.Scoped);
services.AddScoped<IDataContext, DataContext>();
services.AddScoped<IRepositoryLanguage, RepositoryLanguage>();
services.AddScoped<IRepositoryTransaction, RepositoryTransaction>();
services.AddScoped<IRepositoryTransactionCategory, RepositoryTransactionCategory>();
services.AddScoped<IRepositoryTransactionCategoryLcz, RepositoryTransactionCategoryLcz>();
services.AddScoped<IRepositoryUserTransaction, RepositoryUserTransaction>();
...
services.AddScoped<IDataAccessServiceTransaction, DataAccessServiceTransaction>();
services.AddScoped<IDataAccessServiceTransactionCategory, DataAccessServiceTransactionCategory>();
...
}
public void ConfigureServices(IServiceCollection services)
{
services.AddMvc(
config => {
config.Filters.Add(typeof(ExceptionFilter));
}
);
services.AddDbContext<DataContext>(
options => options.UseSqlServer(Configuration.GetConnectionString("DefaultConnection")), ServiceLifetime.Scoped);
services.RunDependencyInstaller();
}
- Install project from Nuget:
Install-Package DependencesInstaller
- Inside ConfigureServices method call extension method RunDependencyInstaller
public void ConfigureServices(IServiceCollection services)
{
...
services.RunDependencyInstaller();
...
}
Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.
We use SemVer for versioning. For the versions available, see the tags on this repository.
- Artur Lavrov
- Nikita Litvinenko
IoC-manager-net (by Bogdan Mart)
See also the list of contributors who participated in this project.
This project is licensed under the MIT License - see the LICENSE.md file for details