Skip to content

Latest commit

 

History

History
97 lines (68 loc) · 3.05 KB

README.md

File metadata and controls

97 lines (68 loc) · 3.05 KB

DependenciesInstaller image

Build status License: MIT

Lightweight, fast and convenient dependencies installer for ASP.NET Core

Replace huge piles of similar code for dependencies registration with one single line.

Before

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>();
    ...
}

After

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();
}

Getting Started

  1. Install project from Nuget:
Install-Package DependencesInstaller 
  1. Inside ConfigureServices method call extension method RunDependencyInstaller
public void ConfigureServices(IServiceCollection services)
{
    ...
    
    services.RunDependencyInstaller();
    
    ...
}

Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository.

Authors

  • Artur Lavrov
  • Nikita Litvinenko

Inspired by

IoC-manager-net (by Bogdan Mart)

See also the list of contributors who participated in this project.

License

This project is licensed under the MIT License - see the LICENSE.md file for details