diff --git a/STX.SPAL.Core/Brokers/DependenciesInjection/DependencyInjectionBroker.ServiceCollection.cs b/STX.SPAL.Core/Brokers/DependenciesInjection/DependencyInjectionBroker.ServiceCollection.cs new file mode 100644 index 0000000..590f83f --- /dev/null +++ b/STX.SPAL.Core/Brokers/DependenciesInjection/DependencyInjectionBroker.ServiceCollection.cs @@ -0,0 +1,15 @@ +// ---------------------------------------------------------------------------------- +// Copyright (c) The Standard Organization: A coalition of the Good-Hearted Engineers +// ---------------------------------------------------------------------------------- + +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.DependencyInjection.Extensions; + +namespace STX.SPAL.Core.Brokers.DependenciesInjection +{ + internal partial class DependencyInjectionBroker + { + public void RegisterServiceDescriptor(ServiceDescriptor serviceDescriptor) => + serviceColllection.Add(serviceDescriptor); + } +} diff --git a/STX.SPAL.Core/Brokers/DependenciesInjection/DependencyInjectionBroker.ServiceProvider.cs b/STX.SPAL.Core/Brokers/DependenciesInjection/DependencyInjectionBroker.ServiceProvider.cs new file mode 100644 index 0000000..c529e14 --- /dev/null +++ b/STX.SPAL.Core/Brokers/DependenciesInjection/DependencyInjectionBroker.ServiceProvider.cs @@ -0,0 +1,21 @@ +// ---------------------------------------------------------------------------------- +// Copyright (c) The Standard Organization: A coalition of the Good-Hearted Engineers +// ---------------------------------------------------------------------------------- + +using System; +using Microsoft.Extensions.DependencyInjection; + +namespace STX.SPAL.Core.Brokers.DependenciesInjection +{ + internal partial class DependencyInjectionBroker + { + public IServiceProvider BuildServiceProvider() => + serviceColllection.BuildServiceProvider(); + + public T ResolveImplementation(ServiceProvider serviceProvider) => + serviceProvider.GetRequiredService(); + + T ResolveImplementation(ServiceProvider serviceProvider, string spalId) => + serviceProvider.GetRequiredKeyedService(spalId); + } +} diff --git a/STX.SPAL.Core/Brokers/DependenciesInjection/DependencyInjectionBroker.cs b/STX.SPAL.Core/Brokers/DependenciesInjection/DependencyInjectionBroker.cs new file mode 100644 index 0000000..3c712f5 --- /dev/null +++ b/STX.SPAL.Core/Brokers/DependenciesInjection/DependencyInjectionBroker.cs @@ -0,0 +1,18 @@ +// ---------------------------------------------------------------------------------- +// Copyright (c) The Standard Organization: A coalition of the Good-Hearted Engineers +// ---------------------------------------------------------------------------------- + +using Microsoft.Extensions.DependencyInjection; + +namespace STX.SPAL.Core.Brokers.DependenciesInjection +{ + internal partial class DependencyInjectionBroker : IDependencyInjectionBroker + { + private readonly ServiceCollection serviceColllection; + + public DependencyInjectionBroker() + { + serviceColllection = new ServiceCollection(); + } + } +} diff --git a/STX.SPAL.Core/Brokers/DependenciesInjection/IDependencyInjectionBroker.ServiceCollection.cs b/STX.SPAL.Core/Brokers/DependenciesInjection/IDependencyInjectionBroker.ServiceCollection.cs new file mode 100644 index 0000000..47cc90d --- /dev/null +++ b/STX.SPAL.Core/Brokers/DependenciesInjection/IDependencyInjectionBroker.ServiceCollection.cs @@ -0,0 +1,13 @@ +// ---------------------------------------------------------------------------------- +// Copyright (c) The Standard Organization: A coalition of the Good-Hearted Engineers +// ---------------------------------------------------------------------------------- + +using Microsoft.Extensions.DependencyInjection; + +namespace STX.SPAL.Core.Brokers.DependenciesInjection +{ + internal partial interface IDependencyInjection + { + void RegisterServiceDescriptor(ServiceDescriptor serviceDescriptor); + } +} diff --git a/STX.SPAL.Core/Brokers/DependenciesInjection/IDependencyInjectionBroker.ServiceProvider.cs b/STX.SPAL.Core/Brokers/DependenciesInjection/IDependencyInjectionBroker.ServiceProvider.cs new file mode 100644 index 0000000..d60d1d1 --- /dev/null +++ b/STX.SPAL.Core/Brokers/DependenciesInjection/IDependencyInjectionBroker.ServiceProvider.cs @@ -0,0 +1,16 @@ +// ---------------------------------------------------------------------------------- +// Copyright (c) The Standard Organization: A coalition of the Good-Hearted Engineers +// ---------------------------------------------------------------------------------- + +using System; +using Microsoft.Extensions.DependencyInjection; + +namespace STX.SPAL.Core.Brokers.DependenciesInjection +{ + internal partial interface IDependencyInjection + { + IServiceProvider BuildServiceProvider(); + T ResolveImplementation(ServiceProvider serviceProvider); + T ResolveImplementation(ServiceProvider serviceProvider, string spalId); + } +} diff --git a/STX.SPAL.Core/Brokers/DependenciesInjection/IDependencyInjectionBroker.cs b/STX.SPAL.Core/Brokers/DependenciesInjection/IDependencyInjectionBroker.cs new file mode 100644 index 0000000..adb4473 --- /dev/null +++ b/STX.SPAL.Core/Brokers/DependenciesInjection/IDependencyInjectionBroker.cs @@ -0,0 +1,10 @@ +// ---------------------------------------------------------------------------------- +// Copyright (c) The Standard Organization: A coalition of the Good-Hearted Engineers +// ---------------------------------------------------------------------------------- + +namespace STX.SPAL.Core.Brokers.DependenciesInjection +{ + internal partial interface IDependencyInjectionBroker + { + } +} diff --git a/STX.SPAL.Core/STX.SPAL.Core.csproj b/STX.SPAL.Core/STX.SPAL.Core.csproj index 772198d..0952944 100644 --- a/STX.SPAL.Core/STX.SPAL.Core.csproj +++ b/STX.SPAL.Core/STX.SPAL.Core.csproj @@ -17,6 +17,7 @@ +