Release 2022.10 #112

Merged
edraft merged 51 commits from 2022.10 into master 2022-09-30 15:48:19 +02:00
3 changed files with 13 additions and 1 deletions
Showing only changes of commit 88e83db330 - Show all commits

View File

@ -9,6 +9,13 @@ class Scope(ScopeABC):
def __init__(self, service_provider: ServiceProviderABC):
self._service_provider = service_provider
self._service_provider.set_scope(self)
ScopeABC.__init__(self)
def __enter__(self):
return self
def __exit__(self, *args):
self.dispose()
@property
def service_provider(self) -> ServiceProviderABC:

View File

@ -18,7 +18,7 @@ class ScopeABC(ABC):
pass
@abstractmethod
def dispose():
def dispose(self):
r"""Sets service_provider to None
"""
pass

View File

@ -53,4 +53,9 @@ class Application(ApplicationABC):
ip_pipe2: IPAddressPipe = self._services.get_service(IPAddressPipe)
Console.write_line(f'DI working: {test == test2 and ip_pipe != ip_pipe2}')
Console.write_line(self._services.get_service(LoggerABC))
scope = self._services.create_scope()
Console.write_line('scope', scope)
with self._services.create_scope() as s:
Console.write_line('with scope', s)
# self.test_send_mail()