Skip to content

KosmonikOS/CustomDependencyInjectionContainer

Repository files navigation

Custom Dependency Injection Container

This is a custom Dependency Injection Container written using .NET 6.

Features

  • Lightweight and easy to use
  • Supports both reflection-based and lambda-based activation builders

Activation Builders

The container supports two types of activation builders:

Activation Builder Description
ReflectionBasedActivationBuilder Uses reflection to resolve services.
LambdaBasedActivationBuilder Uses LINQ Lambda Expressions to resolve services. This is the default activation builder and can be faster than reflection in certain cases.

Usage

var builder = new ContainerBuilder(); builder.AddSingleton(typeof(IService<>), typeof(Service1<>)); var container = builder.Build(); using (container) { using (var scope1 = container.CreateScope()) { var service1 = scope1.Resolve(typeof(IService)); } }

Note

This is a personal project and is not intended for production use. It is provided as an example of a custom dependency inject container and is not actively maintained.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages