From a683b70c5f261de3372380d2922d501bd280ce1f Mon Sep 17 00:00:00 2001 From: Sven Heidemann Date: Tue, 23 Mar 2021 20:23:30 +0100 Subject: [PATCH] [WIP] Improved service collection --- src/cpl/dependency_injection/service_collection.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/cpl/dependency_injection/service_collection.py b/src/cpl/dependency_injection/service_collection.py index 64214ac4..0b26ac71 100644 --- a/src/cpl/dependency_injection/service_collection.py +++ b/src/cpl/dependency_injection/service_collection.py @@ -4,6 +4,7 @@ from cpl.application.application_runtime_abc import ApplicationRuntimeABC from cpl.configuration.configuration_abc import ConfigurationABC from cpl.database.context import DatabaseContextABC from cpl.dependency_injection.service_factory import ServiceFactory +from cpl.dependency_injection.service_factory_abc import ServiceFactoryABC from cpl.dependency_injection.service_provider_abc import ServiceProviderABC from cpl.dependency_injection.service_collection_abc import ServiceCollectionABC from cpl.dependency_injection.service_descriptor import ServiceDescriptor @@ -63,5 +64,8 @@ class ServiceCollection(ServiceCollectionABC): else: self._add_descriptor(service_type, ServiceLifetimeEnum.transient) + def build_service_factory(self) -> ServiceFactoryABC: + return ServiceFactory(self._service_descriptors, self._configuration, self._runtime) + def build_service_provider(self) -> ServiceProviderABC: - return ServiceProvider(ServiceFactory(self._service_descriptors, self._configuration, self._runtime)) + return ServiceProvider(self.build_service_factory())