Skip to content

hexog/ws2

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Ws2

Common utilities for .NET projects.

Install

dotnet add package Ws2.DependencyInjection
dotnet add package Ws2.Hosting
dotnet add package Ws2.Async
dotnet add package Ws2.Data

Usage

Ws2.DependencyInjection

Program.cs

var builder = WebApplication.CreateBuilder(args);
builder.Services.AddServicesFromAssembly(typeof(Program).Assembly);

MyService.cs

public interface IMyInterface
{
}

[ScopedService<IMyInterface>]
public class MyService : IMyInterface
{
}

[SingletonService]
public class SomeService
{
}

[ScopedService]
public class SomeScopedService
{
    public SomeScopedService(IMyInterface myService, SomeService someService)
    {
    }
}

Available attributes (source):

  • [ScopedService]
  • [SingletonService]
  • [TransientService]

About

Common utilities for .NET projects

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages