Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kolosovpetro/ioc-container
Simple Reflection-driven Inversion of Control container.
https://github.com/kolosovpetro/ioc-container
dependency-injection inversion-of-control ioc ioc-container
Last synced: 2 months ago
JSON representation
Simple Reflection-driven Inversion of Control container.
- Host: GitHub
- URL: https://github.com/kolosovpetro/ioc-container
- Owner: kolosovpetro
- Created: 2020-10-03T11:02:55.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2022-05-30T19:24:02.000Z (over 2 years ago)
- Last Synced: 2023-03-06T07:17:49.073Z (almost 2 years ago)
- Topics: dependency-injection, inversion-of-control, ioc, ioc-container
- Language: C#
- Homepage:
- Size: 54.7 KB
- Stars: 9
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# IoC Container
## Description
Simple IoC Container. This container consists of the following layers:
Snippet:
```cs
IBuilder builder = new Builder();
builder.AddSingleton();
builder.AddSingleton();
builder.AddSingleton();
var container = builder.Build();
var loggerService = container.GetInstance();
```- Builder: abstraction over container, builds container, registers types and returns concrete container.
- Container: has a methods in order to register types and returns concrete instance, which implements TConctract
- Service: entity with type properties, concrete implementation of TContract, and enum property lifetime## To Do
- Implement following responsibilities:
- Builder -- builds container,
- Container -- registers type and gives an instance from service
- Service -- contains instance, lifetime, types.
- ~~Create abstraction layer to reduce cast~~ (done)
- Create and throw custom exceptions:
- InvalidTypeException:
- ~~to be thrown when TImplementation doesn't implement TContract~~ (done)
- TypeAlreadyRegisteredException:
- ~~to be thrown when user try to add TConctract which is already registered~~ (done)
- TypeNotFoundException:
- ~~to be thrown if TConctract is not registered in container~~ (done)
- ~~Perform tests for singleton and transient objects~~ (done)
- ~~Implement logic such that will provide always new instance in Transient, and to keep instance in case if Singleton~~ (done)
- ~~Unite all logics under one dictionary ~~ (done)