From e816546eb2f201f31c3c4849169043df48d825c3 Mon Sep 17 00:00:00 2001 From: Simon G Date: Fri, 18 Sep 2020 22:37:35 +0200 Subject: [PATCH] - add OpenGenericRegistration --- .../Registrations/IOpenGenericRegistration.cs | 13 ++++++++++ .../Registrations/OpenGenericRegistration.cs | 26 +++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 LightweightIocContainer/Interfaces/Registrations/IOpenGenericRegistration.cs create mode 100644 LightweightIocContainer/Registrations/OpenGenericRegistration.cs diff --git a/LightweightIocContainer/Interfaces/Registrations/IOpenGenericRegistration.cs b/LightweightIocContainer/Interfaces/Registrations/IOpenGenericRegistration.cs new file mode 100644 index 0000000..4081365 --- /dev/null +++ b/LightweightIocContainer/Interfaces/Registrations/IOpenGenericRegistration.cs @@ -0,0 +1,13 @@ +// Author: Simon Gockner +// Created: 2020-09-18 +// Copyright(c) 2020 SimonG. All Rights Reserved. + +using System; + +namespace LightweightIocContainer.Interfaces.Registrations +{ + public interface IOpenGenericRegistration : IRegistration, ILifestyleProvider + { + Type ImplementationType { get; } + } +} \ No newline at end of file diff --git a/LightweightIocContainer/Registrations/OpenGenericRegistration.cs b/LightweightIocContainer/Registrations/OpenGenericRegistration.cs new file mode 100644 index 0000000..03a51f1 --- /dev/null +++ b/LightweightIocContainer/Registrations/OpenGenericRegistration.cs @@ -0,0 +1,26 @@ +// Author: Simon Gockner +// Created: 2020-09-18 +// Copyright(c) 2020 SimonG. All Rights Reserved. + +using System; +using LightweightIocContainer.Interfaces.Registrations; + +namespace LightweightIocContainer.Registrations +{ + public class OpenGenericRegistration : IOpenGenericRegistration + { + public OpenGenericRegistration(Type interfaceType, Type implementationType, Lifestyle lifestyle) + { + InterfaceType = interfaceType; + ImplementationType = implementationType; + Lifestyle = lifestyle; + + Name = $"{InterfaceType.Name}, {ImplementationType.Name}, Lifestyle: {Lifestyle.ToString()}"; + } + + public string Name { get; } + public Type InterfaceType { get; } + public Type ImplementationType { get; } + public Lifestyle Lifestyle { get; } + } +} \ No newline at end of file