This is a custom Dependency Injection Container written using .NET 6.
- Lightweight and easy to use
- Supports both reflection-based and lambda-based 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. |
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)); } }
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.