|
|
3 years ago | |
|---|---|---|
| .github/workflows | 3 years ago | |
| .idea/.idea.LightweightIocContainer/.idea | 4 years ago | |
| LightweightIocContainer | 3 years ago | |
| LightweightIocContainer.Validation | 3 years ago | |
| Test.LightweightIocContainer | 3 years ago | |
| Test.LightweightIocContainer.Validation | 3 years ago | |
| .gitattributes | 7 years ago | |
| .gitignore | 5 years ago | |
| LICENSE.md | 6 years ago | |
| LightweightIocContainer.sln | 3 years ago | |
| LightweightIocContainer.sln.DotSettings | 4 years ago | |
| README.md | 3 years ago | |
README.md
Lightweight IOC Container
A lightweight IOC Container that is powerful enough to do all the things you need it to do.
Get started with the Lightweight IOC Container
How to install
The easiest way to install the Lightweight IOC Container is by using NuGet through the .NET CLI:
> dotnet add package LightweightIocContainer --version 4.0.0-beta9
Example usage
-
IocContainer container = new(); -
Install
IIocInstallers for the container:container.Install(new Installer()); -
Resolve one instance from the container:
IFooFactory fooFactory = container.Resolve<IFooFactory>(); -
Use this instance to create what your application needs:
IFoo foo = fooFactory.Create(); -
When your application is finished, don't forget to dispose your
IocContainer:container.Dispose();
Validation
There is the option to install the LightweightIocContainer.Validation package:
> dotnet add package LightweightIocContainer.Validaton --version 4.0.0-beta9
With this you can validate your IocContainer setup by using the IocValidator in a unit test:
[TestFixture]
public class IocValidationTest
{
[Test]
public void ValidateIocContainerSetup()
{
IocContainer container = new();
container.Install(new Installer());
IocValidator validator = new(container);
validator.Validate();
}
}
If this test is successful, everything is correctly installed and can be resolved by the IocContainer. By going through the thrown exceptions in case of a failed test you will see what is not working correctly with your current setup.
Demo Project
There is a demo project available where you can check out how different functions of the Lightweight IOC Container can be used.