You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/overview/providers.md
+7-1Lines changed: 7 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -221,5 +221,11 @@ class AModule(ModuleBase):
221
221
222
222
In the above example, we are tagging `Foo` as `first_foo` and `FooB` as `second_foo`. By doing this, we can resolve both services using their tag names, thus providing the possibility of resolving services by tag name or type.
223
223
224
-
Also, services can be injected as a dependency by using tags. To achieve this, the `InjectByTag` decorator is used as a `**constructor**` argument.
224
+
Also, services can be injected as a dependency by using tags. To achieve this, `InjectByTag` is used as a `**constructor**` argument.
225
225
This allows for more flexibility in managing dependencies and resolving services based on tags.
226
+
227
+
`InjectByTag` supports two syntaxes:
228
+
-**Callable syntax**: `InjectByTag('tag_name')`
229
+
-**Generic syntax**: `InjectByTag[T("tag_name")]` where T is from `ellar.common.types.T`
230
+
231
+
Both syntaxes work identically and can be used interchangeably based on your preference.
0 commit comments