2022.12 #133

Merged
edraft merged 85 commits from 2022.12 into master 2022-12-25 11:58:35 +01:00
3 changed files with 18 additions and 18 deletions
Showing only changes of commit c09f2f8e83 - Show all commits

View File

@ -93,7 +93,7 @@ class ServiceProvider(ServiceProviderABC):
self._scope = scope self._scope = scope
def create_scope(self) -> ScopeABC: def create_scope(self) -> ScopeABC:
sb = ScopeBuilder(ServiceProvider(self._service_descriptors, self._configuration, self._database_context)) sb = ScopeBuilder(ServiceProvider(copy.deepcopy(self._service_descriptors), self._configuration, self._database_context))
return sb.build() return sb.build()
def get_service(self, service_type: type) -> Optional[object]: def get_service(self, service_type: type) -> Optional[object]:

View File

@ -20,26 +20,23 @@ class Application(ApplicationABC):
pass pass
def main(self): def main(self):
Console.write_line('Scope1') with self._services.create_scope() as scope:
scope1: Scope = self._services.create_scope() Console.write_line('Scope1')
ts: TestService = scope1.service_provider.get_service(TestService) ts: TestService = scope.service_provider.get_service(TestService)
ts.run() ts.run()
dit: DITesterService = scope1.service_provider.get_service(DITesterService) dit: DITesterService = scope.service_provider.get_service(DITesterService)
dit.run() dit.run()
t = scope1
b = t.service_provider
scope1.dispose()
#Console.write_line('Disposed:') #Console.write_line('Disposed:')
#ts1: TestService = scope1.service_provider.get_service(TestService) #ts1: TestService = scope1.service_provider.get_service(TestService)
#ts1.run() #ts1.run()
Console.write_line('Scope2') with self._services.create_scope() as scope:
scope2: Scope = self._services.create_scope() Console.write_line('Scope2')
ts: TestService = scope2.service_provider.get_service(TestService) ts: TestService = scope.service_provider.get_service(TestService)
ts.run() ts.run()
dit: DITesterService = scope2.service_provider.get_service(DITesterService) dit: DITesterService = scope.service_provider.get_service(DITesterService)
dit.run() dit.run()
Console.write_line('Global') Console.write_line('Global')
self._part_of_scoped() self._part_of_scoped()

View File

@ -16,7 +16,10 @@
"LicenseName": "", "LicenseName": "",
"LicenseDescription": "", "LicenseDescription": "",
"Dependencies": [ "Dependencies": [
"sh_cpl>=2021.10.0.post1" "cpl-core==2022.12.0"
],
"DevDependencies": [
"cpl-cli==2022.12.0"
], ],
"PythonVersion": ">=3.9.2", "PythonVersion": ">=3.9.2",
"PythonPath": {}, "PythonPath": {},