diff --git a/LightweightIocContainer/ActionExtension.cs b/LightweightIocContainer/ActionExtension.cs
index 10dd279..db5a6e6 100644
--- a/LightweightIocContainer/ActionExtension.cs
+++ b/LightweightIocContainer/ActionExtension.cs
@@ -4,23 +4,22 @@
using System;
-namespace LightweightIocContainer
+namespace LightweightIocContainer;
+
+internal static class ActionExtension
{
- internal static class ActionExtension
+ ///
+ /// Convert an to an of an inherited
+ ///
+ /// The of the to convert to, has to be implemented by
+ /// The of the given , has to implement
+ /// The given to convert
+ /// An converted from the given
+ public static Action? Convert(this Action? action) where T1 : T2
{
- ///
- /// Convert an to an of an inherited
- ///
- /// The of the to convert to, has to be implemented by
- /// The of the given , has to implement
- /// The given to convert
- /// An converted from the given
- public static Action? Convert(this Action? action) where T1 : T2
- {
- if (action == null)
- return null;
+ if (action == null)
+ return null;
- return t => action(t);
- }
+ return t => action(t);
}
}
\ No newline at end of file
diff --git a/LightweightIocContainer/EnumerableExtension.cs b/LightweightIocContainer/EnumerableExtension.cs
index 16ec33e..8906fa8 100644
--- a/LightweightIocContainer/EnumerableExtension.cs
+++ b/LightweightIocContainer/EnumerableExtension.cs
@@ -6,61 +6,60 @@ using System;
using System.Collections.Generic;
using System.Linq;
-namespace LightweightIocContainer
+namespace LightweightIocContainer;
+
+internal static class EnumerableExtension
{
- internal static class EnumerableExtension
- {
- ///
- /// Returns the first element of a , or a new instance of a given if the contains no elements
- ///
- /// The source of the
- /// The given to return if the contains no elements
- /// The given
- /// The first element of the , or a new instance of a given if the contains no elements
- public static TSource FirstOrGiven(this IEnumerable source) where TGiven : TSource, new() =>
- source.TryGetFirst(null);
+ ///
+ /// Returns the first element of a , or a new instance of a given if the contains no elements
+ ///
+ /// The source of the
+ /// The given to return if the contains no elements
+ /// The given
+ /// The first element of the , or a new instance of a given if the contains no elements
+ public static TSource FirstOrGiven(this IEnumerable source) where TGiven : TSource, new() =>
+ source.TryGetFirst(null);
- ///
- /// Returns the first element of a that satisfies a condition, or a new instance of a given if no such element is found
- ///
- /// The source of the
- /// The given to return if the contains no element that satisfies the given condition
- /// The given
- /// A function to test each element for a condition
- /// The first element of the that satisfies a condition, or a new instance of the given if no such element is found
- public static TSource FirstOrGiven(this IEnumerable source, Func predicate) where TGiven : TSource, new() =>
- source.TryGetFirst(predicate);
+ ///
+ /// Returns the first element of a that satisfies a condition, or a new instance of a given if no such element is found
+ ///
+ /// The source of the
+ /// The given to return if the contains no element that satisfies the given condition
+ /// The given
+ /// A function to test each element for a condition
+ /// The first element of the that satisfies a condition, or a new instance of the given if no such element is found
+ public static TSource FirstOrGiven(this IEnumerable source, Func predicate) where TGiven : TSource, new() =>
+ source.TryGetFirst(predicate);
- ///
- /// Tries to get the first element of the given or creates a new element of a given when no element is found
- ///
- /// The source of the
- /// The given to create a new element when no fitting element is found
- /// The given
- /// A function to test each element for a condition
- /// The first element of the or a new instance of the given when no element is found
- private static TSource TryGetFirst(this IEnumerable source, Func? predicate) where TGiven : TSource, new()
+ ///
+ /// Tries to get the first element of the given or creates a new element of a given when no element is found
+ ///
+ /// The source of the
+ /// The given to create a new element when no fitting element is found
+ /// The given
+ /// A function to test each element for a condition
+ /// The first element of the or a new instance of the given when no element is found
+ private static TSource TryGetFirst(this IEnumerable source, Func? predicate) where TGiven : TSource, new()
+ {
+ try
{
- try
- {
- return predicate == null ? source.First() : source.First(predicate);
- }
- catch (Exception)
- {
- return new TGiven();
- }
+ return predicate == null ? source.First() : source.First(predicate);
}
-
- ///
- /// Executes an for each item in an
- ///
- /// The
- /// The
- /// The of the items in the
- public static void ForEach(this IEnumerable enumerable, Action action)
+ catch (Exception)
{
- foreach (T item in enumerable)
- action(item);
+ return new TGiven();
}
}
+
+ ///
+ /// Executes an for each item in an
+ ///
+ /// The
+ /// The
+ /// The of the items in the
+ public static void ForEach(this IEnumerable enumerable, Action action)
+ {
+ foreach (T item in enumerable)
+ action(item);
+ }
}
\ No newline at end of file
diff --git a/LightweightIocContainer/Exceptions/CircularDependencyException.cs b/LightweightIocContainer/Exceptions/CircularDependencyException.cs
index 6d9f064..f205462 100644
--- a/LightweightIocContainer/Exceptions/CircularDependencyException.cs
+++ b/LightweightIocContainer/Exceptions/CircularDependencyException.cs
@@ -7,55 +7,54 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
-namespace LightweightIocContainer.Exceptions
+namespace LightweightIocContainer.Exceptions;
+
+///
+/// A circular dependency was detected during
+///
+internal class CircularDependencyException : IocContainerException
{
///
/// A circular dependency was detected during
///
- internal class CircularDependencyException : IocContainerException
+ /// The currently resolving
+ /// The resolve stack at the time the was thrown
+ public CircularDependencyException(Type resolvingType, List resolveStack)
{
- ///
- /// A circular dependency was detected during
- ///
- /// The currently resolving
- /// The resolve stack at the time the was thrown
- public CircularDependencyException(Type resolvingType, List resolveStack)
- {
- ResolvingType = resolvingType;
- ResolveStack = resolveStack;
- }
+ ResolvingType = resolvingType;
+ ResolveStack = resolveStack;
+ }
- ///
- /// The currently resolving
- ///
- public Type ResolvingType { get; }
+ ///
+ /// The currently resolving
+ ///
+ public Type ResolvingType { get; }
- ///
- /// The resolve stack at the time the was thrown
- ///
- public List ResolveStack { get; }
+ ///
+ /// The resolve stack at the time the was thrown
+ ///
+ public List ResolveStack { get; }
- ///
- /// The exception message
- ///
- public override string Message
+ ///
+ /// The exception message
+ ///
+ public override string Message
+ {
+ get
{
- get
- {
- StringBuilder message = new($"Circular dependency has been detected when trying to resolve `{ResolvingType}`.\n");
- if (!ResolveStack.Any())
- return message.ToString();
+ StringBuilder message = new($"Circular dependency has been detected when trying to resolve `{ResolvingType}`.\n");
+ if (!ResolveStack.Any())
+ return message.ToString();
- message.Append("Resolve stack that resulted in the circular dependency:\n");
- message.Append($"\t`{ResolvingType}` resolved as dependency of\n");
+ message.Append("Resolve stack that resulted in the circular dependency:\n");
+ message.Append($"\t`{ResolvingType}` resolved as dependency of\n");
- for (int i = ResolveStack.Count - 1; i >= 1 ; i--)
- message.Append($"\t`{ResolveStack[i]}` resolved as dependency of\n");
+ for (int i = ResolveStack.Count - 1; i >= 1 ; i--)
+ message.Append($"\t`{ResolveStack[i]}` resolved as dependency of\n");
- message.Append($"\t`{ResolveStack[0]}` which is the root type being resolved.");
- return message.ToString();
- }
+ message.Append($"\t`{ResolveStack[0]}` which is the root type being resolved.");
+ return message.ToString();
}
}
}
\ No newline at end of file
diff --git a/LightweightIocContainer/Exceptions/ConstructorNotMatchingException.cs b/LightweightIocContainer/Exceptions/ConstructorNotMatchingException.cs
index ef01735..a8fde2d 100644
--- a/LightweightIocContainer/Exceptions/ConstructorNotMatchingException.cs
+++ b/LightweightIocContainer/Exceptions/ConstructorNotMatchingException.cs
@@ -5,25 +5,24 @@
using System;
using System.Reflection;
-namespace LightweightIocContainer.Exceptions
+namespace LightweightIocContainer.Exceptions;
+
+///
+/// The constructor does not match the given or resolvable arguments
+///
+internal class ConstructorNotMatchingException : IocContainerException
{
///
/// The constructor does not match the given or resolvable arguments
///
- internal class ConstructorNotMatchingException : IocContainerException
- {
- ///
- /// The constructor does not match the given or resolvable arguments
- ///
- /// The constructor that does not match
- /// The inner exception
- public ConstructorNotMatchingException(ConstructorInfo constructor, Exception exception)
- : base($"Constructor {constructor} does not match the given or resolvable arguments.", exception) =>
- Constructor = constructor;
+ /// The constructor that does not match
+ /// The inner exception
+ public ConstructorNotMatchingException(ConstructorInfo constructor, Exception exception)
+ : base($"Constructor {constructor} does not match the given or resolvable arguments.", exception) =>
+ Constructor = constructor;
- ///
- /// The constructor that does not match
- ///
- public ConstructorInfo Constructor { get; }
- }
+ ///
+ /// The constructor that does not match
+ ///
+ public ConstructorInfo Constructor { get; }
}
\ No newline at end of file
diff --git a/LightweightIocContainer/Exceptions/GenericMethodNotFoundException.cs b/LightweightIocContainer/Exceptions/GenericMethodNotFoundException.cs
index 8346587..de445ed 100644
--- a/LightweightIocContainer/Exceptions/GenericMethodNotFoundException.cs
+++ b/LightweightIocContainer/Exceptions/GenericMethodNotFoundException.cs
@@ -4,21 +4,20 @@
using System;
-namespace LightweightIocContainer.Exceptions
+namespace LightweightIocContainer.Exceptions;
+
+///
+/// Could not find generic method
+///
+internal class GenericMethodNotFoundException : Exception
{
///
/// Could not find generic method
///
- internal class GenericMethodNotFoundException : Exception
+ /// The name of the generic method
+ public GenericMethodNotFoundException(string functionName)
+ : base($"Could not find function {functionName}")
{
- ///
- /// Could not find generic method
- ///
- /// The name of the generic method
- public GenericMethodNotFoundException(string functionName)
- : base($"Could not find function {functionName}")
- {
- }
}
}
\ No newline at end of file
diff --git a/LightweightIocContainer/Exceptions/IllegalAbstractMethodCreationException.cs b/LightweightIocContainer/Exceptions/IllegalAbstractMethodCreationException.cs
index fbafcb7..105f1fd 100644
--- a/LightweightIocContainer/Exceptions/IllegalAbstractMethodCreationException.cs
+++ b/LightweightIocContainer/Exceptions/IllegalAbstractMethodCreationException.cs
@@ -4,25 +4,24 @@
using System.Reflection;
-namespace LightweightIocContainer.Exceptions
+namespace LightweightIocContainer.Exceptions;
+
+///
+/// The creation of the abstract method is illegal in its current state
+///
+internal class IllegalAbstractMethodCreationException : IocContainerException
{
///
/// The creation of the abstract method is illegal in its current state
///
- internal class IllegalAbstractMethodCreationException : IocContainerException
- {
- ///
- /// The creation of the abstract method is illegal in its current state
- ///
- /// The exception message
- /// The method that is illegal to create
- public IllegalAbstractMethodCreationException(string message, MethodInfo method)
- : base(message) =>
- Method = method;
+ /// The exception message
+ /// The method that is illegal to create
+ public IllegalAbstractMethodCreationException(string message, MethodInfo method)
+ : base(message) =>
+ Method = method;
- ///
- /// The Method whose creation is illegal
- ///
- public MethodInfo Method { get; }
- }
+ ///
+ /// The Method whose creation is illegal
+ ///
+ public MethodInfo Method { get; }
}
\ No newline at end of file
diff --git a/LightweightIocContainer/Exceptions/InternalResolveException.cs b/LightweightIocContainer/Exceptions/InternalResolveException.cs
index ecfe4e4..06a605e 100644
--- a/LightweightIocContainer/Exceptions/InternalResolveException.cs
+++ b/LightweightIocContainer/Exceptions/InternalResolveException.cs
@@ -4,21 +4,20 @@
using LightweightIocContainer.Interfaces;
-namespace LightweightIocContainer.Exceptions
+namespace LightweightIocContainer.Exceptions;
+
+///
+/// An internal Error happened while the tried to resolve an instance
+///
+internal class InternalResolveException : IocContainerException
{
///
/// An internal Error happened while the tried to resolve an instance
///
- internal class InternalResolveException : IocContainerException
+ /// The exception message
+ public InternalResolveException(string message)
+ : base(message)
{
- ///
- /// An internal Error happened while the tried to resolve an instance
- ///
- /// The exception message
- public InternalResolveException(string message)
- : base(message)
- {
- }
}
}
\ No newline at end of file
diff --git a/LightweightIocContainer/Exceptions/InvalidFactoryRegistrationException.cs b/LightweightIocContainer/Exceptions/InvalidFactoryRegistrationException.cs
index a34bbd5..ca73d51 100644
--- a/LightweightIocContainer/Exceptions/InvalidFactoryRegistrationException.cs
+++ b/LightweightIocContainer/Exceptions/InvalidFactoryRegistrationException.cs
@@ -2,21 +2,20 @@
// Created: 2019-05-20
// Copyright(c) 2019 SimonG. All Rights Reserved.
-namespace LightweightIocContainer.Exceptions
+namespace LightweightIocContainer.Exceptions;
+
+///
+/// The registration of a Factory is not valid
+///
+internal class InvalidFactoryRegistrationException : InvalidRegistrationException
{
///
/// The registration of a Factory is not valid
///
- internal class InvalidFactoryRegistrationException : InvalidRegistrationException
+ /// The exception message
+ public InvalidFactoryRegistrationException(string message)
+ : base(message)
{
- ///
- /// The registration of a Factory is not valid
- ///
- /// The exception message
- public InvalidFactoryRegistrationException(string message)
- : base(message)
- {
- }
}
}
\ No newline at end of file
diff --git a/LightweightIocContainer/Exceptions/InvalidRegistrationException.cs b/LightweightIocContainer/Exceptions/InvalidRegistrationException.cs
index 11753bc..5a7db53 100644
--- a/LightweightIocContainer/Exceptions/InvalidRegistrationException.cs
+++ b/LightweightIocContainer/Exceptions/InvalidRegistrationException.cs
@@ -2,21 +2,20 @@
// Created: 2019-05-20
// Copyright(c) 2019 SimonG. All Rights Reserved.
-namespace LightweightIocContainer.Exceptions
+namespace LightweightIocContainer.Exceptions;
+
+///
+/// The registration is not valid
+///
+internal class InvalidRegistrationException : IocContainerException
{
///
/// The registration is not valid
///
- internal class InvalidRegistrationException : IocContainerException
+ /// The exception message
+ public InvalidRegistrationException(string message)
+ : base(message)
{
- ///
- /// The registration is not valid
- ///
- /// The exception message
- public InvalidRegistrationException(string message)
- : base(message)
- {
- }
}
}
\ No newline at end of file
diff --git a/LightweightIocContainer/Exceptions/IocContainerException.cs b/LightweightIocContainer/Exceptions/IocContainerException.cs
index c021abb..8ed1d21 100644
--- a/LightweightIocContainer/Exceptions/IocContainerException.cs
+++ b/LightweightIocContainer/Exceptions/IocContainerException.cs
@@ -5,38 +5,37 @@
using System;
using System.Collections.Generic;
-namespace LightweightIocContainer.Exceptions
+namespace LightweightIocContainer.Exceptions;
+
+///
+/// A base for the
+///
+public abstract class IocContainerException : Exception
{
///
/// A base for the
///
- public abstract class IocContainerException : Exception
- {
- ///
- /// A base for the
- ///
- protected IocContainerException() => InnerExceptions = new List();
+ protected IocContainerException() => InnerExceptions = new List();
- ///
- /// A base for the
- ///
- /// The message of the
- protected IocContainerException(string message)
- : base(message) =>
- InnerExceptions = new List();
+ ///
+ /// A base for the
+ ///
+ /// The message of the
+ protected IocContainerException(string message)
+ : base(message) =>
+ InnerExceptions = new List();
- ///
- /// A base for the
- ///
- /// The message of the
- /// The inner
- protected IocContainerException(string message, Exception innerException)
- : base(message, innerException) =>
- InnerExceptions = new List {innerException};
+ ///
+ /// A base for the
+ ///
+ /// The message of the
+ /// The inner
+ protected IocContainerException(string message, Exception innerException)
+ : base(message, innerException) =>
+ InnerExceptions = new List {innerException};
- ///
- /// The inner exceptions of the
- ///
- public List InnerExceptions { get; protected init; }
- }
+ ///
+ /// The inner exceptions of the
+ ///
+ public List InnerExceptions { get; protected init; }
}
\ No newline at end of file
diff --git a/LightweightIocContainer/Exceptions/MultipleRegistrationException.cs b/LightweightIocContainer/Exceptions/MultipleRegistrationException.cs
index d64a728..f1bb289 100644
--- a/LightweightIocContainer/Exceptions/MultipleRegistrationException.cs
+++ b/LightweightIocContainer/Exceptions/MultipleRegistrationException.cs
@@ -5,24 +5,23 @@
using System;
using LightweightIocContainer.Interfaces;
-namespace LightweightIocContainer.Exceptions
+namespace LightweightIocContainer.Exceptions;
+
+///
+/// The is already registered differently in this
+///
+internal class MultipleRegistrationException : IocContainerException
{
///
/// The is already registered differently in this
///
- internal class MultipleRegistrationException : IocContainerException
- {
- ///
- /// The is already registered differently in this
- ///
- /// The that is already registered in this
- public MultipleRegistrationException(Type type)
- : base($"Type {type.Name} is already registered differently in this IocContainer.") =>
- Type = type;
+ /// The that is already registered in this
+ public MultipleRegistrationException(Type type)
+ : base($"Type {type.Name} is already registered differently in this IocContainer.") =>
+ Type = type;
- ///
- /// The registered
- ///
- public Type Type { get; }
- }
+ ///
+ /// The registered
+ ///
+ public Type Type { get; }
}
\ No newline at end of file
diff --git a/LightweightIocContainer/Exceptions/MultitonResolveException.cs b/LightweightIocContainer/Exceptions/MultitonResolveException.cs
index b7034a0..aeb514e 100644
--- a/LightweightIocContainer/Exceptions/MultitonResolveException.cs
+++ b/LightweightIocContainer/Exceptions/MultitonResolveException.cs
@@ -4,25 +4,24 @@
using System;
-namespace LightweightIocContainer.Exceptions
+namespace LightweightIocContainer.Exceptions;
+
+///
+/// An error happened while trying to resolve a multiton
+///
+internal class MultitonResolveException : InternalResolveException
{
///
/// An error happened while trying to resolve a multiton
///
- internal class MultitonResolveException : InternalResolveException
- {
- ///
- /// An error happened while trying to resolve a multiton
- ///
- /// The exception message
- /// The of the multiton that's responsible for the exception
- public MultitonResolveException(string message, Type type)
- : base(message) =>
- Type = type;
+ /// The exception message
+ /// The of the multiton that's responsible for the exception
+ public MultitonResolveException(string message, Type type)
+ : base(message) =>
+ Type = type;
- ///
- /// The of the multiton that's responsible for the exception
- ///
- public Type Type { get; }
- }
+ ///
+ /// The of the multiton that's responsible for the exception
+ ///
+ public Type Type { get; }
}
\ No newline at end of file
diff --git a/LightweightIocContainer/Exceptions/NoMatchingConstructorFoundException.cs b/LightweightIocContainer/Exceptions/NoMatchingConstructorFoundException.cs
index b49ff68..c38a002 100644
--- a/LightweightIocContainer/Exceptions/NoMatchingConstructorFoundException.cs
+++ b/LightweightIocContainer/Exceptions/NoMatchingConstructorFoundException.cs
@@ -5,34 +5,33 @@
using System;
using System.Collections.Generic;
-namespace LightweightIocContainer.Exceptions
+namespace LightweightIocContainer.Exceptions;
+
+///
+/// No matching constructor was found for the given or resolvable arguments
+///
+internal class NoMatchingConstructorFoundException : IocContainerException
{
///
/// No matching constructor was found for the given or resolvable arguments
///
- internal class NoMatchingConstructorFoundException : IocContainerException
+ /// The with no matching constructor
+ public NoMatchingConstructorFoundException(Type type)
+ : base($"No matching constructor for {type} found.")
{
- ///
- /// No matching constructor was found for the given or resolvable arguments
- ///
- /// The with no matching constructor
- public NoMatchingConstructorFoundException(Type type)
- : base($"No matching constructor for {type} found.")
- {
- Type = type;
- InnerExceptions = new List();
- }
+ Type = type;
+ InnerExceptions = new List();
+ }
- ///
- /// The with no matching constructor
- ///
- public Type Type { get; }
+ ///
+ /// The with no matching constructor
+ ///
+ public Type Type { get; }
- ///
- /// Add an inner exception to the
- ///
- /// The
- public void AddInnerException(ConstructorNotMatchingException exception) => InnerExceptions.Add(exception);
- }
+ ///
+ /// Add an inner exception to the
+ ///
+ /// The
+ public void AddInnerException(ConstructorNotMatchingException exception) => InnerExceptions.Add(exception);
}
\ No newline at end of file
diff --git a/LightweightIocContainer/Exceptions/NoPublicConstructorFoundException.cs b/LightweightIocContainer/Exceptions/NoPublicConstructorFoundException.cs
index 932b020..ec32547 100644
--- a/LightweightIocContainer/Exceptions/NoPublicConstructorFoundException.cs
+++ b/LightweightIocContainer/Exceptions/NoPublicConstructorFoundException.cs
@@ -4,24 +4,23 @@
using System;
-namespace LightweightIocContainer.Exceptions
+namespace LightweightIocContainer.Exceptions;
+
+///
+/// No public constructor can be found for a
+///
+internal class NoPublicConstructorFoundException : IocContainerException
{
///
/// No public constructor can be found for a
///
- internal class NoPublicConstructorFoundException : IocContainerException
- {
- ///
- /// No public constructor can be found for a
- ///
- /// The with no public constructor
- public NoPublicConstructorFoundException(Type type)
- : base($"No public constructor for {type} found.") =>
- Type = type;
+ /// The with no public constructor
+ public NoPublicConstructorFoundException(Type type)
+ : base($"No public constructor for {type} found.") =>
+ Type = type;
- ///
- /// The with no public constructor
- ///
- public Type Type { get; }
- }
+ ///
+ /// The with no public constructor
+ ///
+ public Type Type { get; }
}
\ No newline at end of file
diff --git a/LightweightIocContainer/Exceptions/TypeNotRegisteredException.cs b/LightweightIocContainer/Exceptions/TypeNotRegisteredException.cs
index 11056b7..a477d23 100644
--- a/LightweightIocContainer/Exceptions/TypeNotRegisteredException.cs
+++ b/LightweightIocContainer/Exceptions/TypeNotRegisteredException.cs
@@ -5,24 +5,23 @@
using System;
using LightweightIocContainer.Interfaces;
-namespace LightweightIocContainer.Exceptions
+namespace LightweightIocContainer.Exceptions;
+
+///
+/// The is not registered in this
+///
+internal class TypeNotRegisteredException : IocContainerException
{
///
/// The is not registered in this
///
- internal class TypeNotRegisteredException : IocContainerException
- {
- ///
- /// The is not registered in this
- ///
- /// The unregistered
- public TypeNotRegisteredException(Type type)
- : base($"Type {type.Name} is not registered in this IocContainer.") =>
- Type = type;
+ /// The unregistered
+ public TypeNotRegisteredException(Type type)
+ : base($"Type {type.Name} is not registered in this IocContainer.") =>
+ Type = type;
- ///
- /// The unregistered
- ///
- public Type Type { get; }
- }
+ ///
+ /// The unregistered
+ ///
+ public Type Type { get; }
}
\ No newline at end of file
diff --git a/LightweightIocContainer/Exceptions/UnknownRegistrationException.cs b/LightweightIocContainer/Exceptions/UnknownRegistrationException.cs
index cc1a290..8ae5809 100644
--- a/LightweightIocContainer/Exceptions/UnknownRegistrationException.cs
+++ b/LightweightIocContainer/Exceptions/UnknownRegistrationException.cs
@@ -4,21 +4,20 @@
using LightweightIocContainer.Interfaces.Registrations;
-namespace LightweightIocContainer.Exceptions
+namespace LightweightIocContainer.Exceptions;
+
+///
+/// An unknown was used
+///
+internal class UnknownRegistrationException : IocContainerException
{
///
/// An unknown was used
///
- internal class UnknownRegistrationException : IocContainerException
+ /// The exception message
+ public UnknownRegistrationException(string message)
+ : base(message)
{
- ///
- /// An unknown was used
- ///
- /// The exception message
- public UnknownRegistrationException(string message)
- : base(message)
- {
- }
}
}
\ No newline at end of file
diff --git a/LightweightIocContainer/Factories/CustomTypedFactory.cs b/LightweightIocContainer/Factories/CustomTypedFactory.cs
index 67fa08c..e13a4d3 100644
--- a/LightweightIocContainer/Factories/CustomTypedFactory.cs
+++ b/LightweightIocContainer/Factories/CustomTypedFactory.cs
@@ -4,13 +4,12 @@
using LightweightIocContainer.Interfaces.Factories;
-namespace LightweightIocContainer.Factories
+namespace LightweightIocContainer.Factories;
+
+///
+/// implementation for custom implemented factories
+///
+public class CustomTypedFactory : TypedFactoryBase
{
- ///
- /// implementation for custom implemented factories
- ///
- public class CustomTypedFactory : TypedFactoryBase
- {
- }
}
\ No newline at end of file
diff --git a/LightweightIocContainer/Factories/TypedFactory.cs b/LightweightIocContainer/Factories/TypedFactory.cs
index ddd0c16..b89c7ba 100644
--- a/LightweightIocContainer/Factories/TypedFactory.cs
+++ b/LightweightIocContainer/Factories/TypedFactory.cs
@@ -10,133 +10,132 @@ using LightweightIocContainer.Exceptions;
using LightweightIocContainer.Interfaces;
using LightweightIocContainer.Interfaces.Factories;
-namespace LightweightIocContainer.Factories
+namespace LightweightIocContainer.Factories;
+
+///
+/// Class to help implement an abstract typed factory
+///
+/// The type of the abstract factory
+public class TypedFactory : TypedFactoryBase, ITypedFactory
{
+ private const string CLEAR_MULTITON_INSTANCE_METHOD_NAME = "ClearMultitonInstance";
+
///
- /// Class to help implement an abstract typed factory
+ /// The
///
- /// The type of the abstract factory
- public class TypedFactory : TypedFactoryBase, ITypedFactory
- {
- private const string CLEAR_MULTITON_INSTANCE_METHOD_NAME = "ClearMultitonInstance";
-
- ///
- /// The
- ///
- /// The current instance of the
- public TypedFactory(IocContainer container) => Factory = CreateFactory(container);
-
- ///
- /// The implemented abstract typed factory/>
- ///
- public TFactory Factory { get; set; }
+ /// The current instance of the
+ public TypedFactory(IocContainer container) => Factory = CreateFactory(container);
+
+ ///
+ /// The implemented abstract typed factory/>
+ ///
+ public TFactory Factory { get; set; }
- ///
- /// Creates the factory from the given abstract factory type
- ///
- /// Factory registration is invalid
- /// Creation of abstract methods are illegal in their current state
- private TFactory CreateFactory(IocContainer container)
- {
- Type factoryType = typeof(TFactory);
+ ///
+ /// Creates the factory from the given abstract factory type
+ ///
+ /// Factory registration is invalid
+ /// Creation of abstract methods are illegal in their current state
+ private TFactory CreateFactory(IocContainer container)
+ {
+ Type factoryType = typeof(TFactory);
- AssemblyBuilder assemblyBuilder = AssemblyBuilder.DefineDynamicAssembly(new AssemblyName("Factory"), AssemblyBuilderAccess.Run);
- ModuleBuilder moduleBuilder = assemblyBuilder.DefineDynamicModule("Factory");
- TypeBuilder typeBuilder = moduleBuilder.DefineType($"TypedFactory.{factoryType.Name}");
+ AssemblyBuilder assemblyBuilder = AssemblyBuilder.DefineDynamicAssembly(new AssemblyName("Factory"), AssemblyBuilderAccess.Run);
+ ModuleBuilder moduleBuilder = assemblyBuilder.DefineDynamicModule("Factory");
+ TypeBuilder typeBuilder = moduleBuilder.DefineType($"TypedFactory.{factoryType.Name}");
- typeBuilder.AddInterfaceImplementation(factoryType);
+ typeBuilder.AddInterfaceImplementation(factoryType);
- //add `private readonly IIocContainer _container` field
- FieldBuilder containerFieldBuilder = typeBuilder.DefineField("_container", typeof(IocContainer), FieldAttributes.Private | FieldAttributes.InitOnly);
+ //add `private readonly IIocContainer _container` field
+ FieldBuilder containerFieldBuilder = typeBuilder.DefineField("_container", typeof(IocContainer), FieldAttributes.Private | FieldAttributes.InitOnly);
- //add ctor
- ConstructorBuilder constructorBuilder = typeBuilder.DefineConstructor(MethodAttributes.Public, CallingConventions.HasThis, new[] {typeof(IocContainer)});
- ILGenerator constructorGenerator = constructorBuilder.GetILGenerator();
- constructorGenerator.Emit(OpCodes.Ldarg_0);
- constructorGenerator.Emit(OpCodes.Ldarg_1);
- constructorGenerator.Emit(OpCodes.Stfld, containerFieldBuilder); //set `_container` field
- constructorGenerator.Emit(OpCodes.Ret);
+ //add ctor
+ ConstructorBuilder constructorBuilder = typeBuilder.DefineConstructor(MethodAttributes.Public, CallingConventions.HasThis, new[] {typeof(IocContainer)});
+ ILGenerator constructorGenerator = constructorBuilder.GetILGenerator();
+ constructorGenerator.Emit(OpCodes.Ldarg_0);
+ constructorGenerator.Emit(OpCodes.Ldarg_1);
+ constructorGenerator.Emit(OpCodes.Stfld, containerFieldBuilder); //set `_container` field
+ constructorGenerator.Emit(OpCodes.Ret);
- foreach (MethodInfo createMethod in CreateMethods)
- {
- //create a method that looks like this
- //public `createMethod.ReturnType` Create(`createMethod.GetParameters()`)
- //{
- // return IIocContainer.Resolve(`createMethod.ReturnType`, params);
- //}
+ foreach (MethodInfo createMethod in CreateMethods)
+ {
+ //create a method that looks like this
+ //public `createMethod.ReturnType` Create(`createMethod.GetParameters()`)
+ //{
+ // return IIocContainer.Resolve(`createMethod.ReturnType`, params);
+ //}
- ParameterInfo[] args = createMethod.GetParameters();
+ ParameterInfo[] args = createMethod.GetParameters();
- MethodBuilder methodBuilder = typeBuilder.DefineMethod(createMethod.Name, MethodAttributes.Public | MethodAttributes.Virtual,
- createMethod.ReturnType, (from arg in args select arg.ParameterType).ToArray());
- typeBuilder.DefineMethodOverride(methodBuilder, createMethod);
+ MethodBuilder methodBuilder = typeBuilder.DefineMethod(createMethod.Name, MethodAttributes.Public | MethodAttributes.Virtual,
+ createMethod.ReturnType, (from arg in args select arg.ParameterType).ToArray());
+ typeBuilder.DefineMethodOverride(methodBuilder, createMethod);
- ILGenerator generator = methodBuilder.GetILGenerator();
+ ILGenerator generator = methodBuilder.GetILGenerator();
- generator.Emit(OpCodes.Ldarg_0);
- generator.Emit(OpCodes.Ldfld, containerFieldBuilder);
+ generator.Emit(OpCodes.Ldarg_0);
+ generator.Emit(OpCodes.Ldfld, containerFieldBuilder);
- if (args.Any())
- {
- generator.Emit(OpCodes.Ldc_I4_S, args.Length);
- generator.Emit(OpCodes.Newarr, typeof(object));
-
- for (int i = 0; i < args.Length; i++)
- {
- generator.Emit(OpCodes.Dup);
- generator.Emit(OpCodes.Ldc_I4_S, i);
- generator.Emit(OpCodes.Ldarg_S, i + 1);
- generator.Emit(OpCodes.Box, args[i].ParameterType); //Boxing is only needed for simple datatypes, but for now it is not a problem to box everything
- generator.Emit(OpCodes.Stelem_Ref);
- }
- }
- else
+ if (args.Any())
+ {
+ generator.Emit(OpCodes.Ldc_I4_S, args.Length);
+ generator.Emit(OpCodes.Newarr, typeof(object));
+
+ for (int i = 0; i < args.Length; i++)
{
- MethodInfo emptyArray = typeof(Array).GetMethod(nameof(Array.Empty))!.MakeGenericMethod(typeof(object));
- generator.EmitCall(OpCodes.Call, emptyArray, null);
+ generator.Emit(OpCodes.Dup);
+ generator.Emit(OpCodes.Ldc_I4_S, i);
+ generator.Emit(OpCodes.Ldarg_S, i + 1);
+ generator.Emit(OpCodes.Box, args[i].ParameterType); //Boxing is only needed for simple datatypes, but for now it is not a problem to box everything
+ generator.Emit(OpCodes.Stelem_Ref);
}
-
- generator.EmitCall(OpCodes.Call, typeof(IocContainer).GetMethod(nameof(IocContainer.FactoryResolve), new[] { typeof(object[]) })!.MakeGenericMethod(createMethod.ReturnType), null);
- generator.Emit(OpCodes.Castclass, createMethod.ReturnType);
- generator.Emit(OpCodes.Ret);
}
-
- //if factory contains a method to clear multiton instances
- MethodInfo? multitonClearMethod = factoryType.GetMethods().FirstOrDefault(m => m.Name.Equals(CLEAR_MULTITON_INSTANCE_METHOD_NAME));
- if (multitonClearMethod != null)
+ else
{
- //create a method that looks like this
- //public void ClearMultitonInstance()
- //{
- // IIocContainer.ClearMultitonInstances();
- //}
+ MethodInfo emptyArray = typeof(Array).GetMethod(nameof(Array.Empty))!.MakeGenericMethod(typeof(object));
+ generator.EmitCall(OpCodes.Call, emptyArray, null);
+ }
- if (multitonClearMethod.IsGenericMethod)
- {
- Type? typeToClear = multitonClearMethod.GetGenericArguments().FirstOrDefault();
- if (typeToClear == null)
- throw new IllegalAbstractMethodCreationException("No Type to clear specified.", multitonClearMethod);
+ generator.EmitCall(OpCodes.Call, typeof(IocContainer).GetMethod(nameof(IocContainer.FactoryResolve), new[] { typeof(object[]) })!.MakeGenericMethod(createMethod.ReturnType), null);
+ generator.Emit(OpCodes.Castclass, createMethod.ReturnType);
+ generator.Emit(OpCodes.Ret);
+ }
- MethodBuilder multitonClearMethodBuilder = typeBuilder.DefineMethod(multitonClearMethod.Name, MethodAttributes.Public | MethodAttributes.Virtual,
- multitonClearMethod.ReturnType, null);
- multitonClearMethodBuilder.DefineGenericParameters(typeToClear.Name);
+ //if factory contains a method to clear multiton instances
+ MethodInfo? multitonClearMethod = factoryType.GetMethods().FirstOrDefault(m => m.Name.Equals(CLEAR_MULTITON_INSTANCE_METHOD_NAME));
+ if (multitonClearMethod != null)
+ {
+ //create a method that looks like this
+ //public void ClearMultitonInstance()
+ //{
+ // IIocContainer.ClearMultitonInstances();
+ //}
- typeBuilder.DefineMethodOverride(multitonClearMethodBuilder, multitonClearMethod);
+ if (multitonClearMethod.IsGenericMethod)
+ {
+ Type? typeToClear = multitonClearMethod.GetGenericArguments().FirstOrDefault();
+ if (typeToClear == null)
+ throw new IllegalAbstractMethodCreationException("No Type to clear specified.", multitonClearMethod);
- ILGenerator multitonClearGenerator = multitonClearMethodBuilder.GetILGenerator();
- multitonClearGenerator.Emit(OpCodes.Ldarg_0);
- multitonClearGenerator.Emit(OpCodes.Ldfld, containerFieldBuilder);
+ MethodBuilder multitonClearMethodBuilder = typeBuilder.DefineMethod(multitonClearMethod.Name, MethodAttributes.Public | MethodAttributes.Virtual,
+ multitonClearMethod.ReturnType, null);
+ multitonClearMethodBuilder.DefineGenericParameters(typeToClear.Name);
- multitonClearGenerator.EmitCall(OpCodes.Call, typeof(IocContainer).GetMethod(nameof(IocContainer.ClearMultitonInstances))!.MakeGenericMethod(typeToClear), null);
- multitonClearGenerator.Emit(OpCodes.Ret);
- }
- else
- {
- throw new IllegalAbstractMethodCreationException("No Type to clear specified.", multitonClearMethod);
- }
- }
+ typeBuilder.DefineMethodOverride(multitonClearMethodBuilder, multitonClearMethod);
+
+ ILGenerator multitonClearGenerator = multitonClearMethodBuilder.GetILGenerator();
+ multitonClearGenerator.Emit(OpCodes.Ldarg_0);
+ multitonClearGenerator.Emit(OpCodes.Ldfld, containerFieldBuilder);
- return Creator.CreateInstance(typeBuilder.CreateTypeInfo()!.AsType(), container);
+ multitonClearGenerator.EmitCall(OpCodes.Call, typeof(IocContainer).GetMethod(nameof(IocContainer.ClearMultitonInstances))!.MakeGenericMethod(typeToClear), null);
+ multitonClearGenerator.Emit(OpCodes.Ret);
+ }
+ else
+ {
+ throw new IllegalAbstractMethodCreationException("No Type to clear specified.", multitonClearMethod);
+ }
}
+
+ return Creator.CreateInstance(typeBuilder.CreateTypeInfo()!.AsType(), container);
}
}
\ No newline at end of file
diff --git a/LightweightIocContainer/Factories/TypedFactoryBase.cs b/LightweightIocContainer/Factories/TypedFactoryBase.cs
index 73b77db..64a6bea 100644
--- a/LightweightIocContainer/Factories/TypedFactoryBase.cs
+++ b/LightweightIocContainer/Factories/TypedFactoryBase.cs
@@ -9,28 +9,27 @@ using System.Reflection;
using LightweightIocContainer.Exceptions;
using LightweightIocContainer.Interfaces.Factories;
-namespace LightweightIocContainer.Factories
+namespace LightweightIocContainer.Factories;
+
+///
+/// Base class for the
+///
+public abstract class TypedFactoryBase : ITypedFactory
{
///
- /// Base class for the
+ /// The create methods of this
///
- public abstract class TypedFactoryBase : ITypedFactory
+ public List CreateMethods
{
- ///
- /// The create methods of this
- ///
- public List CreateMethods
+ get
{
- get
- {
- Type factoryType = typeof(TFactory);
+ Type factoryType = typeof(TFactory);
- List createMethods = factoryType.GetMethods().Where(m => m.ReturnType != typeof(void)).ToList();
- if (!createMethods.Any())
- throw new InvalidFactoryRegistrationException($"Factory {factoryType.Name} has no create methods.");
+ List createMethods = factoryType.GetMethods().Where(m => m.ReturnType != typeof(void)).ToList();
+ if (!createMethods.Any())
+ throw new InvalidFactoryRegistrationException($"Factory {factoryType.Name} has no create methods.");
- return createMethods;
- }
+ return createMethods;
}
}
}
\ No newline at end of file
diff --git a/LightweightIocContainer/GenericMethodCaller.cs b/LightweightIocContainer/GenericMethodCaller.cs
index 41c1da2..7a42af0 100644
--- a/LightweightIocContainer/GenericMethodCaller.cs
+++ b/LightweightIocContainer/GenericMethodCaller.cs
@@ -6,53 +6,52 @@ using System;
using System.Reflection;
using LightweightIocContainer.Exceptions;
-namespace LightweightIocContainer
+namespace LightweightIocContainer;
+
+///
+/// Helper class to call a generic method without generic type parameters
+///
+internal static class GenericMethodCaller
{
///
- /// Helper class to call a generic method without generic type parameters
+ /// Call a generic method without generic type parameters
///
- internal static class GenericMethodCaller
+ /// 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)
{
- ///
- /// 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);
- MethodInfo? genericMethod = method?.MakeGenericMethod(genericParameter);
+ MethodInfo? method = caller.GetType().GetMethod(functionName, bindingFlags);
+ MethodInfo? genericMethod = method?.MakeGenericMethod(genericParameter);
- if (genericMethod == null)
- throw new GenericMethodNotFoundException(functionName);
+ if (genericMethod == null)
+ throw new GenericMethodNotFoundException(functionName);
- try //exceptions thrown by methods called with invoke are wrapped into another exception, the exception thrown by the invoked method can be returned by `Exception.GetBaseException()`
- {
- return genericMethod.Invoke(caller, parameters);
- }
- catch (Exception ex)
- {
- throw ex.GetBaseException();
- }
+ try //exceptions thrown by methods called with invoke are wrapped into another exception, the exception thrown by the invoked method can be returned by `Exception.GetBaseException()`
+ {
+ return genericMethod.Invoke(caller, parameters);
+ }
+ catch (Exception ex)
+ {
+ throw ex.GetBaseException();
}
-
- ///
- /// Call a private generic method without generic type parameters
- ///
- /// The caller of the method
- /// The name of the method to call
- /// The generic parameter as parameter
- /// 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? CallPrivate(object caller, string functionName, Type genericParameter, params object?[] parameters) =>
- Call(caller, functionName, genericParameter, BindingFlags.NonPublic | BindingFlags.Instance, parameters);
}
+
+ ///
+ /// Call a private generic method without generic type parameters
+ ///
+ /// The caller of the method
+ /// The name of the method to call
+ /// The generic parameter as parameter
+ /// 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? CallPrivate(object caller, string functionName, Type genericParameter, params object?[] parameters) =>
+ Call(caller, functionName, genericParameter, BindingFlags.NonPublic | BindingFlags.Instance, parameters);
}
\ No newline at end of file
diff --git a/LightweightIocContainer/Installers/AssemblyInstaller.cs b/LightweightIocContainer/Installers/AssemblyInstaller.cs
index 414daac..3e35273 100644
--- a/LightweightIocContainer/Installers/AssemblyInstaller.cs
+++ b/LightweightIocContainer/Installers/AssemblyInstaller.cs
@@ -9,44 +9,43 @@ using LightweightIocContainer.Interfaces;
using LightweightIocContainer.Interfaces.Installers;
using LightweightIocContainer.Interfaces.Registrations;
-namespace LightweightIocContainer.Installers
+namespace LightweightIocContainer.Installers;
+
+///
+/// An that installs all s for its given
+///
+public class AssemblyInstaller : IAssemblyInstaller
{
///
/// An that installs all s for its given
///
- public class AssemblyInstaller : IAssemblyInstaller
+ /// The from where the s will be installed
+ public AssemblyInstaller(Assembly assembly)
{
- ///
- /// An that installs all s for its given
- ///
- /// The from where the s will be installed
- public AssemblyInstaller(Assembly assembly)
- {
- Installers = new List();
+ Installers = new List();
- Type[] types = assembly.GetTypes();
- foreach (Type type in types)
- {
- if (!typeof(IIocInstaller).IsAssignableFrom(type) || type.IsNestedPrivate)
- continue;
+ Type[] types = assembly.GetTypes();
+ foreach (Type type in types)
+ {
+ if (!typeof(IIocInstaller).IsAssignableFrom(type) || type.IsNestedPrivate)
+ continue;
- Installers.Add(Creator.CreateInstance(type));
- }
+ Installers.Add(Creator.CreateInstance(type));
}
+ }
- ///
- /// The s of the Assembly that this is installing
- ///
- public List Installers { get; }
+ ///
+ /// The s of the Assembly that this is installing
+ ///
+ public List Installers { get; }
- ///
- /// Install the found s in the given
- ///
- /// The where s are added
- public void Install(IRegistrationCollector registration)
- {
- foreach (IIocInstaller installer in Installers)
- installer.Install(registration);
- }
+ ///
+ /// Install the found s in the given
+ ///
+ /// The where s are added
+ public void Install(IRegistrationCollector registration)
+ {
+ foreach (IIocInstaller installer in Installers)
+ installer.Install(registration);
}
}
\ No newline at end of file
diff --git a/LightweightIocContainer/Installers/FromAssembly.cs b/LightweightIocContainer/Installers/FromAssembly.cs
index c13f2dd..fcb868e 100644
--- a/LightweightIocContainer/Installers/FromAssembly.cs
+++ b/LightweightIocContainer/Installers/FromAssembly.cs
@@ -5,28 +5,27 @@
using System.Reflection;
using LightweightIocContainer.Interfaces.Installers;
-namespace LightweightIocContainer.Installers
+namespace LightweightIocContainer.Installers;
+
+///
+/// Helper class that supplies methods to find the wanted
+///
+public static class FromAssembly
{
///
- /// Helper class that supplies methods to find the wanted
+ /// Get an that installs from the calling the method
///
- public static class FromAssembly
+ /// A new with the calling
+ public static IAssemblyInstaller This()
{
- ///
- /// Get an that installs from the calling the method
- ///
- /// A new with the calling
- public static IAssemblyInstaller This()
- {
- Assembly assembly = Assembly.GetCallingAssembly();
- return new AssemblyInstaller(assembly);
- }
-
- ///
- /// Get an that installs from the given
- ///
- /// The given
- /// A new with the given
- public static IAssemblyInstaller Instance(Assembly assembly) => new AssemblyInstaller(assembly);
+ Assembly assembly = Assembly.GetCallingAssembly();
+ return new AssemblyInstaller(assembly);
}
+
+ ///
+ /// Get an that installs from the given
+ ///
+ /// The given
+ /// A new with the given
+ public static IAssemblyInstaller Instance(Assembly assembly) => new AssemblyInstaller(assembly);
}
\ No newline at end of file
diff --git a/LightweightIocContainer/Interfaces/Factories/ITypedFactory.cs b/LightweightIocContainer/Interfaces/Factories/ITypedFactory.cs
index f053255..504abc1 100644
--- a/LightweightIocContainer/Interfaces/Factories/ITypedFactory.cs
+++ b/LightweightIocContainer/Interfaces/Factories/ITypedFactory.cs
@@ -5,28 +5,27 @@
using System.Collections.Generic;
using System.Reflection;
-namespace LightweightIocContainer.Interfaces.Factories
+namespace LightweightIocContainer.Interfaces.Factories;
+
+///
+/// Non-generic
+///
+public interface ITypedFactory
{
///
- /// Non-generic
+ /// The create methods of this
///
- public interface ITypedFactory
- {
- ///
- /// The create methods of this
- ///
- List CreateMethods { get; }
- }
+ List CreateMethods { get; }
+}
+///
+/// Class to help implement an abstract typed factory
+///
+/// The type of the abstract factory
+public interface ITypedFactory : ITypedFactory
+{
///
- /// Class to help implement an abstract typed factory
+ /// The implemented abstract typed factory
///
- /// The type of the abstract factory
- public interface ITypedFactory : ITypedFactory
- {
- ///
- /// The implemented abstract typed factory
- ///
- TFactory Factory { get; set; }
- }
+ TFactory Factory { get; set; }
}
\ No newline at end of file
diff --git a/LightweightIocContainer/Interfaces/IIocContainer.cs b/LightweightIocContainer/Interfaces/IIocContainer.cs
index bb0a797..ead70ea 100644
--- a/LightweightIocContainer/Interfaces/IIocContainer.cs
+++ b/LightweightIocContainer/Interfaces/IIocContainer.cs
@@ -6,37 +6,36 @@ using System;
using LightweightIocContainer.Interfaces.Installers;
using LightweightIocContainer.Interfaces.Registrations;
-namespace LightweightIocContainer.Interfaces
+namespace LightweightIocContainer.Interfaces;
+
+///
+/// The main container that carries all s
+///
+public interface IIocContainer : IDisposable
{
///
- /// The main container that carries all s
+ /// Install the given installers for the current
///
- public interface IIocContainer : IDisposable
- {
- ///
- /// Install the given installers for the current
- ///
- /// The given s
- /// An instance of the current
- IIocContainer Install(params IIocInstaller[] installers);
+ /// The given s
+ /// An instance of the current
+ IIocContainer Install(params IIocInstaller[] installers);
- ///
- /// Register an at this
- ///
- /// The that creates an
- public void Register(Func addRegistration);
+ ///
+ /// Register an at this
+ ///
+ /// The that creates an
+ public void Register(Func addRegistration);
- ///
- /// Clear the multiton instances of the given from the registered multitons list
- ///
- /// The to clear the multiton instances
- void ClearMultitonInstances();
+ ///
+ /// Clear the multiton instances of the given from the registered multitons list
+ ///
+ /// The to clear the multiton instances
+ void ClearMultitonInstances();
- ///
- /// Is the given registered with this
- ///
- /// The given
- /// True if the given is registered with this , false if not
- bool IsTypeRegistered();
- }
+ ///
+ /// Is the given registered with this
+ ///
+ /// The given
+ /// True if the given is registered with this , false if not
+ bool IsTypeRegistered();
}
\ No newline at end of file
diff --git a/LightweightIocContainer/Interfaces/IIocResolver.cs b/LightweightIocContainer/Interfaces/IIocResolver.cs
index 7d0475d..5705fa8 100644
--- a/LightweightIocContainer/Interfaces/IIocResolver.cs
+++ b/LightweightIocContainer/Interfaces/IIocResolver.cs
@@ -4,26 +4,25 @@
using System;
-namespace LightweightIocContainer.Interfaces
+namespace LightweightIocContainer.Interfaces;
+
+///
+/// Provides methods
+///
+public interface IIocResolver : IDisposable
{
///
- /// Provides methods
+ /// Gets an instance of the given
///
- public interface IIocResolver : IDisposable
- {
- ///
- /// Gets an instance of the given
- ///
- /// The given
- /// An instance of the given
- T Resolve();
+ /// The given
+ /// An instance of the given
+ T Resolve();
- ///
- /// Gets an instance of the given
- ///
- /// The given
- /// The constructor arguments
- /// An instance of the given
- T Resolve(params object[] arguments);
- }
+ ///
+ /// Gets an instance of the given
+ ///
+ /// The given
+ /// The constructor arguments
+ /// An instance of the given
+ T Resolve(params object[] arguments);
}
\ No newline at end of file
diff --git a/LightweightIocContainer/Interfaces/Installers/IAssemblyInstaller.cs b/LightweightIocContainer/Interfaces/Installers/IAssemblyInstaller.cs
index 7ff917d..d5a3630 100644
--- a/LightweightIocContainer/Interfaces/Installers/IAssemblyInstaller.cs
+++ b/LightweightIocContainer/Interfaces/Installers/IAssemblyInstaller.cs
@@ -5,16 +5,15 @@
using System.Collections.Generic;
using System.Reflection;
-namespace LightweightIocContainer.Interfaces.Installers
+namespace LightweightIocContainer.Interfaces.Installers;
+
+///
+/// An that installs all s for its given
+///
+public interface IAssemblyInstaller : IIocInstaller
{
///
- /// An that installs all s for its given
+ /// The s of the that this is installing
///
- public interface IAssemblyInstaller : IIocInstaller
- {
- ///
- /// The s of the that this is installing
- ///
- List Installers { get; }
- }
+ List Installers { get; }
}
\ No newline at end of file
diff --git a/LightweightIocContainer/Interfaces/Installers/IIocInstaller.cs b/LightweightIocContainer/Interfaces/Installers/IIocInstaller.cs
index ae4f44c..5ec9075 100644
--- a/LightweightIocContainer/Interfaces/Installers/IIocInstaller.cs
+++ b/LightweightIocContainer/Interfaces/Installers/IIocInstaller.cs
@@ -4,17 +4,16 @@
using LightweightIocContainer.Interfaces.Registrations;
-namespace LightweightIocContainer.Interfaces.Installers
+namespace LightweightIocContainer.Interfaces.Installers;
+
+///
+/// The base class for installers
+///
+public interface IIocInstaller
{
///
- /// The base class for installers
+ /// Install the needed s in the given
///
- public interface IIocInstaller
- {
- ///
- /// Install the needed s in the given
- ///
- /// The where s are added
- void Install(IRegistrationCollector registration);
- }
+ /// The where s are added
+ void Install(IRegistrationCollector registration);
}
\ No newline at end of file
diff --git a/LightweightIocContainer/Interfaces/Registrations/Fluent/IOnCreate.cs b/LightweightIocContainer/Interfaces/Registrations/Fluent/IOnCreate.cs
index 53507e3..5a36400 100644
--- a/LightweightIocContainer/Interfaces/Registrations/Fluent/IOnCreate.cs
+++ b/LightweightIocContainer/Interfaces/Registrations/Fluent/IOnCreate.cs
@@ -5,32 +5,31 @@
using System;
using LightweightIocContainer.Interfaces.Installers;
-namespace LightweightIocContainer.Interfaces.Registrations.Fluent
+namespace LightweightIocContainer.Interfaces.Registrations.Fluent;
+
+///
+/// Provides an to the generic
+///
+public interface IOnCreate
{
///
- /// Provides an to the generic
+ /// This is invoked when an instance of this type is created.
+ /// Can be set in the by calling
///
- public interface IOnCreate
- {
- ///
- /// This is invoked when an instance of this type is created.
- /// Can be set in the by calling
- ///
- internal Action