parent
c693b181f1
commit
a71e2b7d88
10 changed files with 155 additions and 56 deletions
@ -0,0 +1,46 @@ |
|||||||
|
<Project Sdk="Microsoft.NET.Sdk"> |
||||||
|
|
||||||
|
<PropertyGroup> |
||||||
|
<TargetFramework>net6.0</TargetFramework> |
||||||
|
<Authors>SimonG</Authors> |
||||||
|
<Copyright>Copyright(c) 2022 SimonG. All Rights Reserved.</Copyright> |
||||||
|
<Description>A lightweight IOC Container Validator.</Description> |
||||||
|
<RepositoryUrl>https://github.com/SimonG96/LightweightIocContainer</RepositoryUrl> |
||||||
|
<LangVersion>default</LangVersion> |
||||||
|
<Nullable>enable</Nullable> |
||||||
|
<ImplicitUsings>enable</ImplicitUsings> |
||||||
|
<DocumentationFile>LightweightIocContainer.Validation.xml</DocumentationFile> |
||||||
|
<VersionPrefix>4.0.0</VersionPrefix> |
||||||
|
<VersionSuffix>beta4</VersionSuffix> |
||||||
|
</PropertyGroup> |
||||||
|
|
||||||
|
<PropertyGroup> |
||||||
|
<GeneratePackageOnBuild>true</GeneratePackageOnBuild> |
||||||
|
<PackageProjectUrl>https://github.com/SimonG96/LightweightIocContainer</PackageProjectUrl> |
||||||
|
<PackageLicenseExpression>MIT</PackageLicenseExpression> |
||||||
|
<PackageReadmeFile>README.md</PackageReadmeFile> |
||||||
|
<IncludeSymbols>true</IncludeSymbols> |
||||||
|
<SymbolPackageFormat>snupkg</SymbolPackageFormat> |
||||||
|
</PropertyGroup> |
||||||
|
|
||||||
|
<ItemGroup> |
||||||
|
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1"> |
||||||
|
<PrivateAssets>all</PrivateAssets> |
||||||
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> |
||||||
|
</PackageReference> |
||||||
|
<PackageReference Include="Moq" Version="4.18.2" /> |
||||||
|
<PackageReference Include="System.Reflection.Emit" Version="4.7.0" /> |
||||||
|
</ItemGroup> |
||||||
|
|
||||||
|
<ItemGroup> |
||||||
|
<Content Include="README.md" Pack="true" PackagePath="" /> |
||||||
|
</ItemGroup> |
||||||
|
|
||||||
|
<ItemGroup Condition="Exists('..\LightweightIocContainer\LightweightIocContainer.csproj')"> |
||||||
|
<ProjectReference Include="..\LightweightIocContainer\LightweightIocContainer.csproj" /> |
||||||
|
</ItemGroup> |
||||||
|
<ItemGroup Condition="!Exists('..\LightweightIocContainer\LightweightIocContainer.csproj')"> |
||||||
|
<PackageReference Include="LightweightIocContainer" Version="$(Version)" /> |
||||||
|
</ItemGroup> |
||||||
|
|
||||||
|
</Project> |
||||||
@ -0,0 +1,33 @@ |
|||||||
|
<?xml version="1.0"?> |
||||||
|
<doc> |
||||||
|
<assembly> |
||||||
|
<name>LightweightIocContainer.Validation</name> |
||||||
|
</assembly> |
||||||
|
<members> |
||||||
|
<member name="T:LightweightIocContainer.Validation.IocValidator"> |
||||||
|
<summary> |
||||||
|
Validator for your <see cref="T:LightweightIocContainer.IocContainer"/> to check if everything can be resolved with your current setup |
||||||
|
</summary> |
||||||
|
</member> |
||||||
|
<member name="M:LightweightIocContainer.Validation.IocValidator.#ctor(LightweightIocContainer.IocContainer)"> |
||||||
|
<summary> |
||||||
|
Validator for your <see cref="T:LightweightIocContainer.IocContainer"/> to check if everything can be resolved with your current setup |
||||||
|
</summary> |
||||||
|
<param name="iocContainer">The <see cref="T:LightweightIocContainer.IocContainer"/></param> |
||||||
|
</member> |
||||||
|
<member name="M:LightweightIocContainer.Validation.IocValidator.AddParameter``2(``1)"> |
||||||
|
<summary> |
||||||
|
Add parameters that can't be default for your type to be created successfully |
||||||
|
</summary> |
||||||
|
<param name="parameter">The new value of the parameter</param> |
||||||
|
<typeparam name="TInterface">The <see cref="T:System.Type"/> of your registered interface</typeparam> |
||||||
|
<typeparam name="TParameter">The <see cref="T:System.Type"/> of your <paramref name="parameter"></paramref></typeparam> |
||||||
|
</member> |
||||||
|
<member name="M:LightweightIocContainer.Validation.IocValidator.Validate"> |
||||||
|
<summary> |
||||||
|
Validates your given <see cref="T:LightweightIocContainer.IocContainer"/> and checks if everything can be resolved with the current setup |
||||||
|
<exception cref="T:System.AggregateException">Collection of all exceptions that are thrown during validation</exception> |
||||||
|
</summary> |
||||||
|
</member> |
||||||
|
</members> |
||||||
|
</doc> |
||||||
@ -0,0 +1,54 @@ |
|||||||
|
# Lightweight IOC Container |
||||||
|
|
||||||
|
A lightweight IOC Container that is powerful enough to do all the things you need it to do. |
||||||
|
|
||||||
|
[](https://github.com/SimonG96/LightweightIocContainer/actions) |
||||||
|
|
||||||
|
[](https://www.nuget.org/packages/LightweightIocContainer/) |
||||||
|
[](https://www.nuget.org/packages/LightweightIocContainer/) |
||||||
|
[](https://www.nuget.org/packages/LightweightIocContainer/) |
||||||
|
|
||||||
|
## Get started with the Lightweight IOC Container Validator |
||||||
|
|
||||||
|
### How to install |
||||||
|
|
||||||
|
The easiest way to [install](https://github.com/SimonG96/LightweightIocContainer/wiki/Install-Lightweight-IOC-Container) the Lightweight IOC Container is by using [NuGet](https://www.nuget.org/packages/LightweightIocContainer/). |
||||||
|
You can either use the [`PackageManager`](https://github.com/SimonG96/LightweightIocContainer/wiki/Install-Lightweight-IOC-Container#packagemanager) in VisualStudio: |
||||||
|
|
||||||
|
```PM |
||||||
|
PM> Install-Package LightweightIocContainer.Validator -Version 4.0.0-beta4 |
||||||
|
``` |
||||||
|
|
||||||
|
or you can use the [`.NET CLI`](https://github.com/SimonG96/LightweightIocContainer/wiki/Install-Lightweight-IOC-Container#net-cli): |
||||||
|
|
||||||
|
```.net |
||||||
|
> dotnet add package LightweightIocContainer.Validator --version 4.0.0-beta4 |
||||||
|
``` |
||||||
|
|
||||||
|
### Validation |
||||||
|
|
||||||
|
You can validate your `IocContainer` setup by using the `IocValidator` in a unit test: |
||||||
|
|
||||||
|
```c# |
||||||
|
[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][demoProjectLink] available where you can check out how different functions of the Lightweight IOC Container can be used. |
||||||
|
|
||||||
|
[demoProjectLink]: https://github.com/SimonG96/LightweightIocContainer_Example |
||||||
Loading…
Reference in new issue