2023.4 #168
@ -127,9 +127,15 @@ class ServiceProvider(ServiceProviderABC):
|
|||||||
self._scope = scope
|
self._scope = scope
|
||||||
|
|
||||||
def create_scope(self) -> ScopeABC:
|
def create_scope(self) -> ScopeABC:
|
||||||
sb = ScopeBuilder(
|
descriptors = []
|
||||||
ServiceProvider(copy.deepcopy(self._service_descriptors), self._configuration, self._database_context)
|
|
||||||
)
|
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()
|
return sb.build()
|
||||||
|
|
||||||
def get_service(self, service_type: T, *args, **kwargs) -> Optional[T]:
|
def get_service(self, service_type: T, *args, **kwargs) -> Optional[T]:
|
||||||
|
Loading…
Reference in New Issue
Block a user