2023.4 #168

Merged
edraft merged 56 commits from 2023.4 into master 2023-04-12 13:57:51 +02:00
2 changed files with 9 additions and 3 deletions
Showing only changes of commit 943f5ad50b - Show all commits

View File

@ -127,9 +127,15 @@ class ServiceProvider(ServiceProviderABC):
self._scope = scope
def create_scope(self) -> ScopeABC:
sb = ScopeBuilder(
ServiceProvider(copy.deepcopy(self._service_descriptors), self._configuration, self._database_context)
)
descriptors = []
for descriptor in self._service_descriptors:
if descriptor.lifetime == ServiceLifetimeEnum.singleton:
descriptors.append(descriptor)
else:
descriptors.append(copy.deepcopy(descriptor))
sb = ScopeBuilder(ServiceProvider(descriptors, self._configuration, self._database_context))
return sb.build()
def get_service(self, service_type: T, *args, **kwargs) -> Optional[T]: