From 7da1a38718c3ca10ff1bac9aebb3310f5f03e097 Mon Sep 17 00:00:00 2001 From: Roman Mogylatov Date: Sun, 30 Aug 2020 13:48:07 -0400 Subject: [PATCH] Update factory injection docs --- docs/providers/factory.rst | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/docs/providers/factory.rst b/docs/providers/factory.rst index fd72a773..d972cf83 100644 --- a/docs/providers/factory.rst +++ b/docs/providers/factory.rst @@ -13,17 +13,16 @@ The first argument of the ``Factory`` provider is a class, a factory function or that creates an object. The rest of the ``Factory`` positional and keyword arguments are the dependencies. -``Factory`` injects the dependencies every time when creates a new object. +``Factory`` injects the dependencies every time when creates a new object. The dependencies are +injected following these rules: -Before injecting the dependencies ``Factory`` prepare them using the following rules: - -+ If the injection is a provider, it is called and the result of the call is injected. ++ If the dependency is a provider, this provider is called and the result of the call is injected. + If you need to inject the provider itself, you should use the ``.provider`` attribute. More at :ref:`factory_providers_delegation`. + All other dependencies are injected *"as is"*. + Positional context arguments are appended after ``Factory`` positional dependencies. -+ Keyword context arguments have the priority over the ``Factory`` keyword dependencies with the same - name. ++ Keyword context arguments have the priority over the ``Factory`` keyword dependencies with the + same name. For example, if injectable value of injection is a :py:class:`Factory`, it will provide new one instance (as a result of its call) every time, when