Skip to content

Latest commit

 

History

History
56 lines (47 loc) · 2.23 KB

README.md

File metadata and controls

56 lines (47 loc) · 2.23 KB

Scutor.AspnetCore.Wireup

GitHub licenseGitHub issuesGitHub starsNuGet Build status NuGet Status

Current version is : Scutor wire up services and classes for asp.net core

This tool will be updated with further needs or requests

Usage

First you need to install it via nuget :

Install-Package Scutor.AspnetCore.Wireup -Version 1.0.0

or install via cli command :

dotnet add package Scutor.AspnetCore.Wireup --version 1.0.0

Writeup can be done in Startup.cs class, simply with one line of code

  public void ConfigureServices(IServiceCollection services)
  {
    // other services can add here
    // like :
    // services.AddMvc();
    // Transient
    services.WireupTransient(this.GetType().Assembly);            
    // Scoped
    services.WireupScoped(this.GetType().Assembly);            
    // Singleton
    services.WireupSingleton(this.GetType().Assembly);            
  }

You can specify search condition for scanning assemblies like this :

  public void ConfigureServices(IServiceCollection services)
  {
    // other services can add here
    // like :
    // services.AddMvc();
    services.AddMvc();
    // Transient
    services.WireupTransient(this.GetType().Assembly, "*Transient_types.dll");            
    // Scoped
    services.WireupScoped(this.GetType().Assembly, "*Scoped_types.dll");            
    // Singleton
    services.WireupSingleton(this.GetType().Assembly, "*Singleton_types.dll");            
  }