From e6ed60f335a3995678d8d5e54df5cd7c5481df14 Mon Sep 17 00:00:00 2001 From: Alan Date: Mon, 30 Sep 2019 07:26:31 -0700 Subject: [PATCH 1/4] Added GetRegisteredServices --- src/LightInject/LightInject.cs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/LightInject/LightInject.cs b/src/LightInject/LightInject.cs index c72755fa..e5ac1554 100644 --- a/src/LightInject/LightInject.cs +++ b/src/LightInject/LightInject.cs @@ -671,6 +671,13 @@ public interface IServiceFactory /// The type of class for which to create an instance. /// An instance of the . object Create(Type serviceType); + + /// + /// Get a list of ServiceRegistrations available for the requested serviceType. + /// + /// The Type for which registrations should be returned. + /// An IEnumerable (possibly empty) of s. + IEnumerable GetRegisteredServices(Type serviceType); } /// @@ -3243,6 +3250,14 @@ public ServiceContainer Clone() ScopeManagerProvider); } + /// + public IEnumerable GetRegisteredServices(Type serviceType) + { + return availableServices.ContainsKey(serviceType) + ? availableServices[serviceType].Values + : Enumerable.Empty(); + } + [MethodImpl(MethodImplOptions.AggressiveInlining)] internal object GetInstance(Type serviceType, Scope scope) { @@ -6283,6 +6298,9 @@ public IEnumerable GetAllInstances(Type serviceType) /// public object Create(Type serviceType) => serviceFactory.Create(serviceType, this); + /// + public IEnumerable GetRegisteredServices(Type serviceType) => serviceFactory.GetRegisteredServices(serviceType); + [MethodImpl(MethodImplOptions.AggressiveInlining)] internal object GetScopedInstance(GetInstanceDelegate getInstanceDelegate, object[] arguments, int instanceDelegateIndex) { From 4ac1f8a41ea410644c927f9f601e75793f27b5bf Mon Sep 17 00:00:00 2001 From: Alan Date: Mon, 30 Sep 2019 07:56:37 -0700 Subject: [PATCH 2/4] Added GetRegisteredServices to Mock --- src/LightInject.Tests/ContainerMock.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/LightInject.Tests/ContainerMock.cs b/src/LightInject.Tests/ContainerMock.cs index b9dd01d2..18a4f085 100644 --- a/src/LightInject.Tests/ContainerMock.cs +++ b/src/LightInject.Tests/ContainerMock.cs @@ -434,5 +434,10 @@ public object GetInstance(Type serviceType, Scope scope, string serviceName) { throw new NotImplementedException(); } + + public IEnumerable GetRegisteredServices(Type serviceType) + { + throw new NotImplementedException(); + } } } \ No newline at end of file From b611af228ea534f9f8f979bca15d6219321ce5f1 Mon Sep 17 00:00:00 2001 From: Alan Draper Date: Thu, 10 Oct 2019 10:36:11 -0700 Subject: [PATCH 3/4] reordering TargetFrameworks seems to fix the problem. --- src/LightInject/LightInject.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/LightInject/LightInject.csproj b/src/LightInject/LightInject.csproj index b5dd3580..e0e4c848 100644 --- a/src/LightInject/LightInject.csproj +++ b/src/LightInject/LightInject.csproj @@ -1,7 +1,7 @@  - netcoreapp2.0;netstandard2.0;netstandard1.6;netstandard1.3;netstandard1.1;net46;net452 + netstandard2.0;netcoreapp2.0;netstandard1.6;netstandard1.3;netstandard1.1;net46;net452 6.1.0 Bernhard Richter https://www.lightinject.net From 339277bfc77698baa17969f6480013d85bc4c161 Mon Sep 17 00:00:00 2001 From: Alan Draper Date: Mon, 28 Oct 2019 09:44:59 -0700 Subject: [PATCH 4/4] version increment and revert framework order. --- src/LightInject/LightInject.csproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/LightInject/LightInject.csproj b/src/LightInject/LightInject.csproj index e0e4c848..36ee9cef 100644 --- a/src/LightInject/LightInject.csproj +++ b/src/LightInject/LightInject.csproj @@ -1,8 +1,8 @@  - netstandard2.0;netcoreapp2.0;netstandard1.6;netstandard1.3;netstandard1.1;net46;net452 - 6.1.0 + netcoreapp2.0;netstandard2.0;netstandard1.6;netstandard1.3;netstandard1.1;net46;net452 + 6.2.0 Bernhard Richter https://www.lightinject.net git