diff --git a/LightweightIocContainer/Exceptions/GenericMethodNotFoundException.cs b/LightweightIocContainer/Exceptions/GenericMethodNotFoundException.cs index 136eb24..1438b54 100644 --- a/LightweightIocContainer/Exceptions/GenericMethodNotFoundException.cs +++ b/LightweightIocContainer/Exceptions/GenericMethodNotFoundException.cs @@ -6,8 +6,15 @@ using System; namespace LightweightIocContainer.Exceptions { + /// + /// Could not find generic method + /// public class GenericMethodNotFoundException : Exception { + /// + /// Could not find generic method + /// + /// The name of the generic method public GenericMethodNotFoundException(string functionName) : base($"Could not find function {functionName}") { diff --git a/LightweightIocContainer/GenericMethodCaller.cs b/LightweightIocContainer/GenericMethodCaller.cs index 799b4b7..bff301d 100644 --- a/LightweightIocContainer/GenericMethodCaller.cs +++ b/LightweightIocContainer/GenericMethodCaller.cs @@ -8,8 +8,22 @@ using LightweightIocContainer.Exceptions; namespace LightweightIocContainer { - public static class GenericMethodCaller + /// + /// Helper class to call a generic method without generic type parameters + /// + internal static class GenericMethodCaller { + /// + /// Call a generic method without generic type parameters + /// + /// The caller of the method + /// The name of the method to call + /// The generic parameter as parameter + /// The to find the method + /// The parameters of the method + /// The result of invoking the method + /// Could not find the generic method + /// Any thrown after invoking the generic method public static object Call(object caller, string functionName, Type genericParameter, BindingFlags bindingFlags, params object[] parameters) { MethodInfo method = caller.GetType().GetMethod(functionName, bindingFlags); diff --git a/LightweightIocContainer/Interfaces/IIocContainer.cs b/LightweightIocContainer/Interfaces/IIocContainer.cs index 7718672..d4c1465 100644 --- a/LightweightIocContainer/Interfaces/IIocContainer.cs +++ b/LightweightIocContainer/Interfaces/IIocContainer.cs @@ -29,8 +29,14 @@ namespace LightweightIocContainer.Interfaces /// The created IDefaultRegistration Register(Lifestyle lifestyle = Lifestyle.Transient) where TImplementation : TInterface; - IOpenGenericRegistration RegisterOpenGenerics(Type tInterface, Type tImplementation, - Lifestyle lifestyle = Lifestyle.Transient); + /// + /// Register an open generic Interface with an open generic Type that implements it + /// + /// The open generic Interface to register + /// The open generic Type that implements the interface + /// The for this + /// The created + IOpenGenericRegistration RegisterOpenGenerics(Type tInterface, Type tImplementation, Lifestyle lifestyle = Lifestyle.Transient); /// /// Register multiple interfaces for a that implements them diff --git a/LightweightIocContainer/Interfaces/Registrations/IOpenGenericRegistration.cs b/LightweightIocContainer/Interfaces/Registrations/IOpenGenericRegistration.cs index 4081365..4aaebc4 100644 --- a/LightweightIocContainer/Interfaces/Registrations/IOpenGenericRegistration.cs +++ b/LightweightIocContainer/Interfaces/Registrations/IOpenGenericRegistration.cs @@ -6,8 +6,14 @@ using System; namespace LightweightIocContainer.Interfaces.Registrations { + /// + /// for open generic types + /// public interface IOpenGenericRegistration : IRegistration, ILifestyleProvider { + /// + /// The that implements the that is registered with this + /// Type ImplementationType { get; } } } \ No newline at end of file diff --git a/LightweightIocContainer/IocContainer.cs b/LightweightIocContainer/IocContainer.cs index c93abe1..c95a555 100644 --- a/LightweightIocContainer/IocContainer.cs +++ b/LightweightIocContainer/IocContainer.cs @@ -68,6 +68,15 @@ namespace LightweightIocContainer return registration; } + /// + /// Register an open generic Interface with an open generic Type that implements it + /// + /// The open generic Interface to register + /// The open generic Type that implements the interface + /// The for this + /// The created + /// Function can only be used to register open generic types + /// Can't register a multiton with open generic registration public IOpenGenericRegistration RegisterOpenGenerics(Type tInterface, Type tImplementation, Lifestyle lifestyle = Lifestyle.Transient) { if (!tInterface.ContainsGenericParameters) diff --git a/LightweightIocContainer/LightweightIocContainer.xml b/LightweightIocContainer/LightweightIocContainer.xml index 331e407..a2891e6 100644 --- a/LightweightIocContainer/LightweightIocContainer.xml +++ b/LightweightIocContainer/LightweightIocContainer.xml @@ -86,6 +86,17 @@ The constructor that does not match + + + Could not find generic method + + + + + Could not find generic method + + The name of the generic method + The creation of the abstract method is illegal in its current state @@ -274,6 +285,24 @@ The implemented abstract typed factory/> + + + Helper class to call a generic method without generic type parameters + + + + + Call a generic method without generic type parameters + + The caller of the method + The name of the method to call + The generic parameter as parameter + The to find the method + The parameters of the method + The result of invoking the method + Could not find the generic method + Any thrown after invoking the generic method + An that installs all s for its given @@ -346,6 +375,15 @@ The for this The created + + + Register an open generic Interface with an open generic Type that implements it + + The open generic Interface to register + The open generic Type that implements the interface + The for this + The created + Register multiple interfaces for a that implements them @@ -609,6 +647,16 @@ The registered interface The registered implementation + + + for open generic types + + + + + The that implements the that is registered with this + + The base registration that is used to register an Interface @@ -705,6 +753,17 @@ The for this The created + + + Register an open generic Interface with an open generic Type that implements it + + The open generic Interface to register + The open generic Type that implements the interface + The for this + The created + Function can only be used to register open generic types + Can't register a multiton with open generic registration + Register multiple interfaces for a that implements them @@ -1078,6 +1137,39 @@ The of the multiton scope + + + for open generic types + + + + + for open generic types + + The of the interface + The of the implementation type + The of this + + + + The name of the + + + + + The of the Interface that is registered with this + + + + + The that implements the that is registered with this + + + + + The Lifestyle of Instances that are created with this + + The that is used to register an Interface diff --git a/LightweightIocContainer/Properties/AssemblyInfo.cs b/LightweightIocContainer/Properties/AssemblyInfo.cs index 581d540..18bea16 100644 --- a/LightweightIocContainer/Properties/AssemblyInfo.cs +++ b/LightweightIocContainer/Properties/AssemblyInfo.cs @@ -4,8 +4,4 @@ using System.Runtime.CompilerServices; -[assembly:InternalsVisibleTo("Test.LightweightIocContainer")] - -namespace LightweightIocContainer.Properties -{ -} \ No newline at end of file +[assembly:InternalsVisibleTo("Test.LightweightIocContainer")] \ No newline at end of file diff --git a/LightweightIocContainer/Registrations/OpenGenericRegistration.cs b/LightweightIocContainer/Registrations/OpenGenericRegistration.cs index 03a51f1..df37b4f 100644 --- a/LightweightIocContainer/Registrations/OpenGenericRegistration.cs +++ b/LightweightIocContainer/Registrations/OpenGenericRegistration.cs @@ -7,8 +7,17 @@ using LightweightIocContainer.Interfaces.Registrations; namespace LightweightIocContainer.Registrations { + /// + /// for open generic types + /// public class OpenGenericRegistration : IOpenGenericRegistration { + /// + /// for open generic types + /// + /// The of the interface + /// The of the implementation type + /// The of this public OpenGenericRegistration(Type interfaceType, Type implementationType, Lifestyle lifestyle) { InterfaceType = interfaceType; @@ -18,9 +27,24 @@ namespace LightweightIocContainer.Registrations Name = $"{InterfaceType.Name}, {ImplementationType.Name}, Lifestyle: {Lifestyle.ToString()}"; } + /// + /// The name of the + /// public string Name { get; } + + /// + /// The of the Interface that is registered with this + /// public Type InterfaceType { get; } + + /// + /// The that implements the that is registered with this + /// public Type ImplementationType { get; } + + /// + /// The Lifestyle of Instances that are created with this + /// public Lifestyle Lifestyle { get; } } } \ No newline at end of file diff --git a/Test.LightweightIocContainer/EnumerableExtensionTest.cs b/Test.LightweightIocContainer/EnumerableExtensionTest.cs index ddc724c..0540ac2 100644 --- a/Test.LightweightIocContainer/EnumerableExtensionTest.cs +++ b/Test.LightweightIocContainer/EnumerableExtensionTest.cs @@ -3,6 +3,7 @@ // Copyright(c) 2019 SimonG. All Rights Reserved. using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; using LightweightIocContainer; using NUnit.Framework; @@ -27,6 +28,7 @@ namespace Test.LightweightIocContainer [Test] + [SuppressMessage("ReSharper", "CollectionNeverUpdated.Local")] public void TestFirstOrGivenNoPredicateEmpty() { List list = new List(); @@ -51,6 +53,7 @@ namespace Test.LightweightIocContainer } [Test] + [SuppressMessage("ReSharper", "CollectionNeverUpdated.Local")] public void TestFirstOrGivenPredicateEmpty() { List list = new List(); diff --git a/Test.LightweightIocContainer/IocContainerRecursionTest.cs b/Test.LightweightIocContainer/IocContainerRecursionTest.cs index 9a0c069..0e3e772 100644 --- a/Test.LightweightIocContainer/IocContainerRecursionTest.cs +++ b/Test.LightweightIocContainer/IocContainerRecursionTest.cs @@ -141,6 +141,7 @@ namespace Test.LightweightIocContainer _iocContainer.Register(); IA a = _iocContainer.Resolve(); + Assert.IsNotNull(a); } [Test] diff --git a/Test.LightweightIocContainer/OpenGenericRegistrationTest.cs b/Test.LightweightIocContainer/OpenGenericRegistrationTest.cs index 391a96a..e1b87d7 100644 --- a/Test.LightweightIocContainer/OpenGenericRegistrationTest.cs +++ b/Test.LightweightIocContainer/OpenGenericRegistrationTest.cs @@ -2,6 +2,7 @@ // Created: 2020-09-18 // Copyright(c) 2020 SimonG. All Rights Reserved. +using System.Diagnostics.CodeAnalysis; using JetBrains.Annotations; using LightweightIocContainer; using LightweightIocContainer.Exceptions; @@ -16,6 +17,7 @@ namespace Test.LightweightIocContainer private IIocContainer _iocContainer; [UsedImplicitly] + [SuppressMessage("ReSharper", "UnusedTypeParameter")] public interface ITest {