Compare commits

..

No commits in common. '1d9bfa88f650026f2aaffe66ef815ffeba9b4ac9' and '129bd0603be16aa134029deb4fd8a12e1b898f60' have entirely different histories.

  1. 1
      .gitignore
  2. 16
      Debug.LightweightIocContainer.FactoryGenerator/Debug.LightweightIocContainer.FactoryGenerator.csproj
  3. 13
      Debug.LightweightIocContainer.FactoryGenerator/SampleClass.cs
  4. 17
      Debug.LightweightIocContainer.FactoryGenerator/SampleInstaller.cs
  5. 151
      LightweightIocContainer.FactoryGenerator/FactoryGenerator.cs
  6. 38
      LightweightIocContainer.FactoryGenerator/LightweightIocContainer.FactoryGenerator.csproj
  7. 9
      LightweightIocContainer.FactoryGenerator/Properties/launchSettings.json
  8. 9
      LightweightIocContainer.FactoryGenerator/README.md
  9. 6
      LightweightIocContainer.Validation/LightweightIocContainer.Validation.csproj
  10. 2
      LightweightIocContainer.Validation/README.md
  11. 12
      LightweightIocContainer.sln
  12. 8
      LightweightIocContainer/Factories/TypedFactory.cs
  13. 6
      LightweightIocContainer/LightweightIocContainer.csproj
  14. 8
      LightweightIocContainer/LightweightIocContainer.xml
  15. 8
      LightweightIocContainer/Registrations/RegistrationBase.cs
  16. 4
      README.md
  17. 10
      Test.LightweightIocContainer.Validation/Test.LightweightIocContainer.Validation.csproj
  18. 10
      Test.LightweightIocContainer/Test.LightweightIocContainer.csproj

1
.gitignore vendored

@ -52,6 +52,7 @@ BenchmarkDotNet.Artifacts/
project.lock.json project.lock.json
project.fragment.lock.json project.fragment.lock.json
artifacts/ artifacts/
**/Properties/launchSettings.json
# StyleCop # StyleCop
StyleCopReport.xml StyleCopReport.xml

@ -1,16 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
<LangVersion>preview</LangVersion>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\LightweightIocContainer\LightweightIocContainer.csproj" />
<ProjectReference Include="..\LightweightIocContainer.FactoryGenerator\LightweightIocContainer.FactoryGenerator.csproj"
OutputItemType="Analyzer"
ReferenceOutputAssembly="false"/>
</ItemGroup>
</Project>

@ -1,13 +0,0 @@
// Author: Simon.Gockner
// Created: 2025-12-01
// Copyright(c) 2025 SimonG. All Rights Reserved.
namespace Debug.LightweightIocContainer.FactoryGenerator;
public class SampleClass : ISampleClass;
public interface ISampleClass;
public interface ISampleClassFactory
{
ISampleClass Create();
}

@ -1,17 +0,0 @@
// Author: Simon.Gockner
// Created: 2025-12-01
// Copyright(c) 2025 SimonG. All Rights Reserved.
using LightweightIocContainer.FactoryGenerator;
using LightweightIocContainer.Interfaces.Installers;
using LightweightIocContainer.Interfaces.Registrations;
namespace Debug.LightweightIocContainer.FactoryGenerator;
public class SampleInstaller : IIocInstaller
{
public void Install(IRegistrationCollector registration)
{
registration.Add<ISampleClass, SampleClass>().WithGeneratedFactory<ISampleClassFactory>();
}
}

@ -1,151 +0,0 @@
// Author: Simon.Gockner
// Created: 2025-12-01
// Copyright(c) 2025 SimonG. All Rights Reserved.
using System.Collections.Immutable;
using System.Text;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.CSharp.Syntax;
namespace LightweightIocContainer.FactoryGenerator;
[Generator]
public class FactoryGenerator : IIncrementalGenerator
{
private const string EXTENSION_CLASS_NAME = "FactoryExtensions";
private const string BUILDER_CLASS_NAME = "GeneratedFactoryBuilder";
private const string GENERATED_FILE_HEADER = "//---GENERATED by FactoryGenerator! DO NOT EDIT!---";
private const string INDENT = " ";
public void Initialize(IncrementalGeneratorInitializationContext context)
{
string? classNamespace = typeof(FactoryGenerator).Namespace;
context.RegisterPostInitializationOutput(c => c.AddSource($"{EXTENSION_CLASS_NAME}.g.cs", GenerateFactoryExtensionsClass(classNamespace, EXTENSION_CLASS_NAME)));
IncrementalValuesProvider<ITypeSymbol?> syntaxProvider = context.SyntaxProvider.CreateSyntaxProvider(IsCallToGenerateFactory, GetTypeArgument);
context.RegisterSourceOutput(syntaxProvider.Collect(), GenerateTypeDependentClasses);
}
private string GenerateFactoryExtensionsClass(string? classNamespace, string className)
{
StringBuilder stringBuilder = new();
stringBuilder.AppendLine(GENERATED_FILE_HEADER);
stringBuilder.AppendLine();
stringBuilder.AppendLine("using LightweightIocContainer.Interfaces.Registrations;");
stringBuilder.AppendLine("using LightweightIocContainer.Interfaces.Registrations.Fluent;");
stringBuilder.AppendLine("using LightweightIocContainer.Registrations;");
stringBuilder.AppendLine();
if (!string.IsNullOrEmpty(classNamespace))
{
stringBuilder.AppendLine($"namespace {classNamespace};");
stringBuilder.AppendLine();
}
stringBuilder.AppendLine($"public static class {className}");;
stringBuilder.AppendLine("{");
stringBuilder.AppendLine($"{INDENT}public static IRegistrationBase WithGeneratedFactory<TFactory>(this IRegistrationBase registration)");
stringBuilder.AppendLine($"{INDENT}{{");
stringBuilder.AppendLine($"{INDENT}{INDENT}TFactory factory = Builder.Create<TFactory>();");
stringBuilder.AppendLine();
stringBuilder.AppendLine($"{INDENT}{INDENT}if (registration is not RegistrationBase registrationBase)");
stringBuilder.AppendLine($"{INDENT}{INDENT}{INDENT}throw new InvalidOperationException(\"The registration must be of type RegistrationBase to add a generated factory.\");");
stringBuilder.AppendLine();
stringBuilder.AppendLine($"{INDENT}{INDENT}registrationBase.AddGeneratedFactory<TFactory>(factory);");
stringBuilder.AppendLine();
stringBuilder.AppendLine($"{INDENT}{INDENT}return registrationBase;");
stringBuilder.AppendLine($"{INDENT}}}");
stringBuilder.AppendLine("}");
return stringBuilder.ToString();
}
private bool IsCallToGenerateFactory(SyntaxNode node, CancellationToken cancellationToken)
{
if (!node.IsKind(SyntaxKind.GenericName) || node is not GenericNameSyntax genericNameSyntax)
return false;
if (!genericNameSyntax.ToString().StartsWith("WithGeneratedFactory"))
return false;
if (genericNameSyntax.TypeArgumentList.Arguments[0] is not IdentifierNameSyntax)
return false;
return true;
}
private ITypeSymbol? GetTypeArgument(GeneratorSyntaxContext syntaxContext, CancellationToken cancellationToken)
{
if (syntaxContext.Node is not GenericNameSyntax genericNameSyntax)
return null;
if (genericNameSyntax.TypeArgumentList.Arguments[0] is not IdentifierNameSyntax identifierNameSyntax)
return null;
if (syntaxContext.SemanticModel.GetSymbolInfo(identifierNameSyntax).Symbol is not ITypeSymbol typeSymbol)
return null;
return typeSymbol;
}
private void GenerateTypeDependentClasses(SourceProductionContext context, ImmutableArray<ITypeSymbol?> types)
{
string? classNamespace = typeof(FactoryGenerator).Namespace;
context.AddSource($"{BUILDER_CLASS_NAME}.g.cs", GenerateBuilderClassSourceCode(classNamespace, types));
}
private string GenerateBuilderClassSourceCode(string? classNamespace, ImmutableArray<ITypeSymbol?> types)
{
StringBuilder stringBuilder = new();
stringBuilder.AppendLine(GENERATED_FILE_HEADER);
stringBuilder.AppendLine();
foreach (string typeNamespace in GetNamespacesOfTypes(types))
stringBuilder.AppendLine($"using {typeNamespace};");
stringBuilder.AppendLine();
if (classNamespace is not null)
{
stringBuilder.AppendLine($"namespace {classNamespace};");
stringBuilder.AppendLine();
}
stringBuilder.AppendLine("public static class Builder");
stringBuilder.AppendLine("{");
stringBuilder.AppendLine($"{INDENT}public static TFactory Create<TFactory>()");
stringBuilder.AppendLine($"{INDENT}{{");
foreach (ITypeSymbol? type in types)
{
if (type is null)
continue;
stringBuilder.AppendLine($"{INDENT}{INDENT}if (typeof(TFactory) == typeof({type.Name}))");
stringBuilder.AppendLine($"{INDENT}{INDENT}{{");
stringBuilder.AppendLine($"{INDENT}{INDENT}{INDENT}return (TFactory) (object) new Generated{type.Name}();");
stringBuilder.AppendLine($"{INDENT}{INDENT}}}");
stringBuilder.AppendLine();
}
stringBuilder.AppendLine($"{INDENT}{INDENT}throw new Exception(\"Invalid type.\");");
stringBuilder.AppendLine($"{INDENT}}}");
stringBuilder.AppendLine("}");
return stringBuilder.ToString();
}
private IEnumerable<string> GetNamespacesOfTypes(ImmutableArray<ITypeSymbol?> types) =>
types.OfType<ITypeSymbol>()
.Select(s => s.ContainingNamespace.IsGlobalNamespace ? null : s.ContainingNamespace.ToString())
.OfType<string>()
.Distinct();
}

@ -1,38 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<Authors>SimonG</Authors>
<Copyright>Copyright(c) 2025 SimonG. All Rights Reserved.</Copyright>
<Description>Incremental generator to generate factories</Description>
<RepositoryUrl>https://github.com/SimonG96/LightweightIocContainer</RepositoryUrl>
<LangVersion>preview</LangVersion>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<EnforceExtendedAnalyzerRules>true</EnforceExtendedAnalyzerRules>
<IsRoslynComponent>true</IsRoslynComponent>
<VersionPrefix>5.0.0</VersionPrefix>
</PropertyGroup>
<PropertyGroup>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<IncludeBuildOutput>false</IncludeBuildOutput>
<SuppressDependenciesWhenPacking>true</SuppressDependenciesWhenPacking>
<PackageProjectUrl>https://github.com/SimonG96/LightweightIocContainer</PackageProjectUrl>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageReadmeFile>README.md</PackageReadmeFile>
</PropertyGroup>
<ItemGroup>
<Content Include="README.md" Pack="true" PackagePath="" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="5.0.0" PrivateAssets="all" Pack="false" />
</ItemGroup>
<ItemGroup>
<!-- Package the generator in the analyzer directory of the nuget package -->
<None Include="$(OutputPath)\$(AssemblyName).dll" Pack="true" PackagePath="analyzers/dotnet/cs" Visible="false" />
</ItemGroup>
</Project>

@ -1,9 +0,0 @@
{
"$schema": "http://json.schemastore.org/launchsettings.json",
"profiles": {
"DebugRoslynSourceGenerator": {
"commandName": "DebugRoslynComponent",
"targetProject": "../Debug.LightweightIocContainer.FactoryGenerator/Debug.LightweightIocContainer.FactoryGenerator.csproj"
}
}
}

@ -1,9 +0,0 @@
## Get started with the Lightweight IOC Container Factory Generator
### How to install
The easiest way to [install](https://github.com/SimonG96/LghtweightIocContainer/wiki/Install-Lightweight-IOC-Container) the Lightweight IOC Container is by using [NuGet](https://www.nuget.org/packages/LightweightIocContainer.FactoryGenerator/) through the [`.NET CLI`](https://github.com/SimonG96/LightweightIocContainer/wiki/Install-Lightweight-IOC-Container#net-cli):
```.net
> dotnet add package LightweightIocContainer.FactoryGenerator --version 5.0.0
```

@ -1,16 +1,16 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>net10.0</TargetFramework> <TargetFramework>net6.0</TargetFramework>
<Authors>SimonG</Authors> <Authors>SimonG</Authors>
<Copyright>Copyright(c) 2025 SimonG. All Rights Reserved.</Copyright> <Copyright>Copyright(c) 2024 SimonG. All Rights Reserved.</Copyright>
<Description>A lightweight IOC Container Validator.</Description> <Description>A lightweight IOC Container Validator.</Description>
<RepositoryUrl>https://github.com/SimonG96/LightweightIocContainer</RepositoryUrl> <RepositoryUrl>https://github.com/SimonG96/LightweightIocContainer</RepositoryUrl>
<LangVersion>latest</LangVersion> <LangVersion>latest</LangVersion>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<DocumentationFile>LightweightIocContainer.Validation.xml</DocumentationFile> <DocumentationFile>LightweightIocContainer.Validation.xml</DocumentationFile>
<VersionPrefix>5.0.0</VersionPrefix> <VersionPrefix>4.4.0</VersionPrefix>
</PropertyGroup> </PropertyGroup>
<PropertyGroup> <PropertyGroup>

@ -5,7 +5,7 @@
The easiest way to [install](https://github.com/SimonG96/LghtweightIocContainer/wiki/Install-Lightweight-IOC-Container) the Lightweight IOC Container is by using [NuGet](https://www.nuget.org/packages/LightweightIocContainer.Validation/) through the [`.NET CLI`](https://github.com/SimonG96/LightweightIocContainer/wiki/Install-Lightweight-IOC-Container#net-cli): The easiest way to [install](https://github.com/SimonG96/LghtweightIocContainer/wiki/Install-Lightweight-IOC-Container) the Lightweight IOC Container is by using [NuGet](https://www.nuget.org/packages/LightweightIocContainer.Validation/) through the [`.NET CLI`](https://github.com/SimonG96/LightweightIocContainer/wiki/Install-Lightweight-IOC-Container#net-cli):
```.net ```.net
> dotnet add package LightweightIocContainer.Validation --version 5.0.0 > dotnet add package LightweightIocContainer.Validaton --version 4.4.0-beta2
``` ```
### Validation ### Validation

@ -11,10 +11,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LightweightIocContainer.Val
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Test.LightweightIocContainer.Validation", "Test.LightweightIocContainer.Validation\Test.LightweightIocContainer.Validation.csproj", "{82818CE7-6219-4A2E-A506-3AE09A00578C}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Test.LightweightIocContainer.Validation", "Test.LightweightIocContainer.Validation\Test.LightweightIocContainer.Validation.csproj", "{82818CE7-6219-4A2E-A506-3AE09A00578C}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LightweightIocContainer.FactoryGenerator", "LightweightIocContainer.FactoryGenerator\LightweightIocContainer.FactoryGenerator.csproj", "{3AAB43AC-1CBA-4A81-81CB-1EAC2AB792E3}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Debug.LightweightIocContainer.FactoryGenerator", "Debug.LightweightIocContainer.FactoryGenerator\Debug.LightweightIocContainer.FactoryGenerator.csproj", "{578ED8B2-A2BE-4E10-9422-4D5AF2E605E0}"
EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU Debug|Any CPU = Debug|Any CPU
@ -37,14 +33,6 @@ Global
{82818CE7-6219-4A2E-A506-3AE09A00578C}.Debug|Any CPU.Build.0 = Debug|Any CPU {82818CE7-6219-4A2E-A506-3AE09A00578C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{82818CE7-6219-4A2E-A506-3AE09A00578C}.Release|Any CPU.ActiveCfg = Release|Any CPU {82818CE7-6219-4A2E-A506-3AE09A00578C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{82818CE7-6219-4A2E-A506-3AE09A00578C}.Release|Any CPU.Build.0 = Release|Any CPU {82818CE7-6219-4A2E-A506-3AE09A00578C}.Release|Any CPU.Build.0 = Release|Any CPU
{3AAB43AC-1CBA-4A81-81CB-1EAC2AB792E3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3AAB43AC-1CBA-4A81-81CB-1EAC2AB792E3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3AAB43AC-1CBA-4A81-81CB-1EAC2AB792E3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3AAB43AC-1CBA-4A81-81CB-1EAC2AB792E3}.Release|Any CPU.Build.0 = Release|Any CPU
{578ED8B2-A2BE-4E10-9422-4D5AF2E605E0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{578ED8B2-A2BE-4E10-9422-4D5AF2E605E0}.Debug|Any CPU.Build.0 = Debug|Any CPU
{578ED8B2-A2BE-4E10-9422-4D5AF2E605E0}.Release|Any CPU.ActiveCfg = Release|Any CPU
{578ED8B2-A2BE-4E10-9422-4D5AF2E605E0}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE

@ -19,17 +19,11 @@ public class TypedFactory<TFactory> : TypedFactoryBase<TFactory>, ITypedFactory<
private const string CLEAR_MULTITON_INSTANCE_METHOD_NAME = "ClearMultitonInstance"; private const string CLEAR_MULTITON_INSTANCE_METHOD_NAME = "ClearMultitonInstance";
/// <summary> /// <summary>
/// Constructor for creating factories dynamically /// The
/// </summary> /// </summary>
/// <param name="container">The current instance of the <see cref="IIocContainer"/></param> /// <param name="container">The current instance of the <see cref="IIocContainer"/></param>
public TypedFactory(IocContainer container) => Factory = CreateFactory(container); public TypedFactory(IocContainer container) => Factory = CreateFactory(container);
/// <summary>
/// Constructor for generated factories
/// </summary>
/// <param name="factory"></param>
public TypedFactory(TFactory factory) => Factory = factory;
/// <summary> /// <summary>
/// The implemented abstract typed factory/> /// The implemented abstract typed factory/>
/// </summary> /// </summary>

@ -1,16 +1,16 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>net10.0</TargetFramework> <TargetFramework>net6.0</TargetFramework>
<Authors>SimonG</Authors> <Authors>SimonG</Authors>
<Copyright>Copyright(c) 2025 SimonG. All Rights Reserved.</Copyright> <Copyright>Copyright(c) 2024 SimonG. All Rights Reserved.</Copyright>
<Description>A lightweight IOC Container that is powerful enough to do all the things you need it to do.</Description> <Description>A lightweight IOC Container that is powerful enough to do all the things you need it to do.</Description>
<RepositoryUrl>https://github.com/SimonG96/LightweightIocContainer</RepositoryUrl> <RepositoryUrl>https://github.com/SimonG96/LightweightIocContainer</RepositoryUrl>
<LangVersion>latest</LangVersion> <LangVersion>latest</LangVersion>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<DocumentationFile>LightweightIocContainer.xml</DocumentationFile> <DocumentationFile>LightweightIocContainer.xml</DocumentationFile>
<VersionPrefix>5.0.0</VersionPrefix> <VersionPrefix>4.4.0</VersionPrefix>
</PropertyGroup> </PropertyGroup>
<PropertyGroup> <PropertyGroup>

@ -384,16 +384,10 @@
</member> </member>
<member name="M:LightweightIocContainer.Factories.TypedFactory`1.#ctor(LightweightIocContainer.IocContainer)"> <member name="M:LightweightIocContainer.Factories.TypedFactory`1.#ctor(LightweightIocContainer.IocContainer)">
<summary> <summary>
Constructor for creating factories dynamically The
</summary> </summary>
<param name="container">The current instance of the <see cref="T:LightweightIocContainer.Interfaces.IIocContainer"/></param> <param name="container">The current instance of the <see cref="T:LightweightIocContainer.Interfaces.IIocContainer"/></param>
</member> </member>
<member name="M:LightweightIocContainer.Factories.TypedFactory`1.#ctor(`0)">
<summary>
Constructor for generated factories
</summary>
<param name="factory"></param>
</member>
<member name="P:LightweightIocContainer.Factories.TypedFactory`1.Factory"> <member name="P:LightweightIocContainer.Factories.TypedFactory`1.Factory">
<summary> <summary>
The implemented abstract typed factory/> The implemented abstract typed factory/>

@ -121,14 +121,6 @@ internal abstract class RegistrationBase : IRegistrationBase, IWithFactoryIntern
return this; return this;
} }
internal void AddGeneratedFactory<TFactory>(TFactory generatedFactory)
{
TypedFactory<TFactory> factory = new(generatedFactory);
Factory = factory;
_container.RegisterFactory(factory);
}
/// <summary> /// <summary>
/// Register a custom implemented factory for the <see cref="IRegistrationBase"/> /// Register a custom implemented factory for the <see cref="IRegistrationBase"/>
/// </summary> /// </summary>

@ -19,7 +19,7 @@ A lightweight IOC Container that is powerful enough to do all the things you nee
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/) through the [`.NET CLI`](https://github.com/SimonG96/LightweightIocContainer/wiki/Install-Lightweight-IOC-Container#net-cli): 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/) through the [`.NET CLI`](https://github.com/SimonG96/LightweightIocContainer/wiki/Install-Lightweight-IOC-Container#net-cli):
```.net ```.net
> dotnet add package LightweightIocContainer --version 5.0.0 > dotnet add package LightweightIocContainer --version 4.4.0
``` ```
### Example usage ### Example usage
@ -59,7 +59,7 @@ The easiest way to [install](https://github.com/SimonG96/LightweightIocContainer
There is the option to install the [LightweightIocContainer.Validation](https://www.nuget.org/packages/LightweightIocContainer.Validation/) package: There is the option to install the [LightweightIocContainer.Validation](https://www.nuget.org/packages/LightweightIocContainer.Validation/) package:
```.net ```.net
> dotnet add package LightweightIocContainer.Validaton --version 5.0.0 > dotnet add package LightweightIocContainer.Validaton --version 4.4.0
``` ```
With this you can validate your `IocContainer` setup by using the `IocValidator` in a unit test: With this you can validate your `IocContainer` setup by using the `IocValidator` in a unit test:

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>net10.0</TargetFramework> <TargetFramework>net9.0</TargetFramework>
<IsPackable>false</IsPackable> <IsPackable>false</IsPackable>
<Authors>SimonG</Authors> <Authors>SimonG</Authors>
<LangVersion>default</LangVersion> <LangVersion>default</LangVersion>
@ -9,11 +9,11 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="JetBrains.Annotations" Version="2025.2.4" /> <PackageReference Include="JetBrains.Annotations" Version="2024.3.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.0.1" /> <PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
<PackageReference Include="NSubstitute" Version="5.3.0" /> <PackageReference Include="NSubstitute" Version="5.3.0" />
<PackageReference Include="nunit" Version="4.4.0" /> <PackageReference Include="nunit" Version="4.2.2" />
<PackageReference Include="NUnit3TestAdapter" Version="6.0.0-beta.2.1"> <PackageReference Include="NUnit3TestAdapter" Version="4.6.0">
<PrivateAssets>all</PrivateAssets> <PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference> </PackageReference>

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>net10.0</TargetFramework> <TargetFramework>net9.0</TargetFramework>
<IsPackable>false</IsPackable> <IsPackable>false</IsPackable>
<Authors>SimonG</Authors> <Authors>SimonG</Authors>
<LangVersion>default</LangVersion> <LangVersion>default</LangVersion>
@ -9,11 +9,11 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="JetBrains.Annotations" Version="2025.2.4" /> <PackageReference Include="JetBrains.Annotations" Version="2024.3.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.0.1" /> <PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
<PackageReference Include="NSubstitute" Version="5.3.0" /> <PackageReference Include="NSubstitute" Version="5.3.0" />
<PackageReference Include="nunit" Version="4.4.0" /> <PackageReference Include="nunit" Version="4.2.2" />
<PackageReference Include="NUnit3TestAdapter" Version="6.0.0-beta.2.1"> <PackageReference Include="NUnit3TestAdapter" Version="4.6.0">
<PrivateAssets>all</PrivateAssets> <PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference> </PackageReference>

Loading…
Cancel
Save