Skip to content

Commit 63f8b27

Browse files
committed
Update the README examples a bit more.
1 parent c714857 commit 63f8b27

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

README.md

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,20 @@ dependency_container.register_singleton(ThirdInterface, ThirdClass)
5656
### Example - Resolving dependencies:
5757

5858
```python
59-
# When resolving scoped dependencies, specify the scope explicitly if needed.
60-
# The scope, often associated with an application service action invocation, can be provided for scoped instances.
61-
# Default resolution is applied for non-scoped instances.
59+
# Resolving dependencies from the dependency container.
6260

61+
# Resolving a transient instance, which is created anew for each resolution.
6362
transient_instance = dependency_container.resolve(SomeInterface)
64-
scoped_instance = dependency_container.resolve(AnotherInterface, scope_name="some-action-id") # application service action invocation ID
65-
singleton_instance = dependency_container.resolve(ThirdInterface)
6663

64+
# Resolving a scoped instance with an optional scope name.
65+
# A scope is often created for each application service action invocation.
66+
# This scope creation typically happens inside the application framework,
67+
# upon entry into the application layer via primary adapters in the infrastructure layer.
68+
# Provide a scope name, such as the auto-created scope, for scoped instances.
69+
scoped_instance = dependency_container.resolve(AnotherInterface, scope_name="auto-created-scope-name")
70+
71+
# Resolving a singleton instance, which remains the same across the entire application.
72+
singleton_instance = dependency_container.resolve(ThirdInterface)
6773
```
6874

6975
### Example - Constructor injection:

0 commit comments

Comments
 (0)