<spanid="cpl-dependency-injection-service-collection"></span><h2>cpl.dependency_injection.service_collection<aclass="headerlink"href="#module-cpl.dependency_injection.service_collection"title="Permalink to this headline">¶</a></h2>
<emclass="property"><spanclass="pre">class</span></em><codeclass="sig-prename descclassname"><spanclass="pre">cpl.dependency_injection.service_collection.</span></code><codeclass="sig-name descname"><spanclass="pre">ServiceCollection</span></code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">config</span></span><spanclass="p"><spanclass="pre">:</span></span><spanclass="n"><aclass="reference internal"href="cpl.configuration.html#cpl.configuration.configuration_abc.ConfigurationABC"title="cpl.configuration.configuration_abc.ConfigurationABC"><spanclass="pre">cpl.configuration.configuration_abc.ConfigurationABC</span></a></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#cpl.dependency_injection.service_collection.ServiceCollection"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname"><spanclass="pre">add_db_context</span></code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">db_context_type</span></span><spanclass="p"><spanclass="pre">:</span></span><spanclass="n"><spanclass="pre">Type</span><spanclass="p"><spanclass="pre">[</span></span><aclass="reference internal"href="cpl.database.context.html#cpl.database.context.database_context_abc.DatabaseContextABC"title="cpl.database.context.database_context_abc.DatabaseContextABC"><spanclass="pre">cpl.database.context.database_context_abc.DatabaseContextABC</span></a><spanclass="p"><spanclass="pre">]</span></span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">db_settings</span></span><spanclass="p"><spanclass="pre">:</span></span><spanclass="n"><aclass="reference internal"href="cpl.database.html#cpl.database.database_settings.DatabaseSettings"title="cpl.database.database_settings.DatabaseSettings"><spanclass="pre">cpl.database.database_settings.DatabaseSettings</span></a></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#cpl.dependency_injection.service_collection.ServiceCollection.add_db_context"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname"><spanclass="pre">add_logging</span></code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#cpl.dependency_injection.service_collection.ServiceCollection.add_logging"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname"><spanclass="pre">add_scoped</span></code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">service_type</span></span><spanclass="p"><spanclass="pre">:</span></span><spanclass="n"><spanclass="pre">Type</span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">service</span></span><spanclass="p"><spanclass="pre">:</span></span><spanclass="n"><spanclass="pre">Optional</span><spanclass="p"><spanclass="pre">[</span></span><spanclass="pre">Callable</span><spanclass="p"><spanclass="pre">]</span></span></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="default_value"><spanclass="pre">None</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#cpl.dependency_injection.service_collection.ServiceCollection.add_scoped"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname"><spanclass="pre">add_singleton</span></code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">service_type</span></span><spanclass="p"><spanclass="pre">:</span></span><spanclass="n"><spanclass="pre">Union</span><spanclass="p"><spanclass="pre">[</span></span><spanclass="pre">type</span><spanclass="p"><spanclass="pre">,</span></span><spanclass="pre">object</span><spanclass="p"><spanclass="pre">]</span></span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">service</span></span><spanclass="p"><spanclass="pre">:</span></span><spanclass="n"><spanclass="pre">Optional</span><spanclass="p"><spanclass="pre">[</span></span><spanclass="pre">Union</span><spanclass="p"><spanclass="pre">[</span></span><spanclass="pre">type</span><spanclass="p"><spanclass="pre">,</span></span><spanclass="pre">object</span><spanclass="p"><spanclass="pre">]</span></span><spanclass="p"><spanclass="pre">]</span></span></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="default_value"><spanclass="pre">None</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#cpl.dependency_injection.service_collection.ServiceCollection.add_singleton"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname"><spanclass="pre">add_transient</span></code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">service_type</span></span><spanclass="p"><spanclass="pre">:</span></span><spanclass="n"><spanclass="pre">type</span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">service</span></span><spanclass="p"><spanclass="pre">:</span></span><spanclass="n"><spanclass="pre">Optional</span><spanclass="p"><spanclass="pre">[</span></span><spanclass="pre">type</span><spanclass="p"><spanclass="pre">]</span></span></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="default_value"><spanclass="pre">None</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#cpl.dependency_injection.service_collection.ServiceCollection.add_transient"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname"><spanclass="pre">build_service_provider</span></code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span>→<aclass="reference internal"href="#cpl.dependency_injection.service_provider_abc.ServiceProviderABC"title="cpl.dependency_injection.service_provider_abc.ServiceProviderABC"><spanclass="pre">cpl.dependency_injection.service_provider_abc.ServiceProviderABC</span></a><aclass="headerlink"href="#cpl.dependency_injection.service_collection.ServiceCollection.build_service_provider"title="Permalink to this definition">¶</a></dt>
<dd><p>Creates instance of the service provider</p>
<spanid="cpl-dependency-injection-service-collection-abc"></span><h2>cpl.dependency_injection.service_collection_abc<aclass="headerlink"href="#module-cpl.dependency_injection.service_collection_abc"title="Permalink to this headline">¶</a></h2>
<emclass="property"><spanclass="pre">class</span></em><codeclass="sig-prename descclassname"><spanclass="pre">cpl.dependency_injection.service_collection_abc.</span></code><codeclass="sig-name descname"><spanclass="pre">ServiceCollectionABC</span></code><aclass="headerlink"href="#cpl.dependency_injection.service_collection_abc.ServiceCollectionABC"title="Permalink to this definition">¶</a></dt>
<emclass="property"><spanclass="pre">abstract</span></em><codeclass="sig-name descname"><spanclass="pre">add_db_context</span></code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">db_context</span></span><spanclass="p"><spanclass="pre">:</span></span><spanclass="n"><spanclass="pre">Type</span><spanclass="p"><spanclass="pre">[</span></span><aclass="reference internal"href="cpl.database.context.html#cpl.database.context.database_context_abc.DatabaseContextABC"title="cpl.database.context.database_context_abc.DatabaseContextABC"><spanclass="pre">cpl.database.context.database_context_abc.DatabaseContextABC</span></a><spanclass="p"><spanclass="pre">]</span></span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">db_settings</span></span><spanclass="p"><spanclass="pre">:</span></span><spanclass="n"><aclass="reference internal"href="cpl.database.html#cpl.database.database_settings.DatabaseSettings"title="cpl.database.database_settings.DatabaseSettings"><spanclass="pre">cpl.database.database_settings.DatabaseSettings</span></a></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#cpl.dependency_injection.service_collection_abc.ServiceCollectionABC.add_db_context"title="Permalink to this definition">¶</a></dt>
<emclass="property"><spanclass="pre">abstract</span></em><codeclass="sig-name descname"><spanclass="pre">add_logging</span></code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#cpl.dependency_injection.service_collection_abc.ServiceCollectionABC.add_logging"title="Permalink to this definition">¶</a></dt>
<emclass="property"><spanclass="pre">abstract</span></em><codeclass="sig-name descname"><spanclass="pre">add_scoped</span></code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">service_type</span></span><spanclass="p"><spanclass="pre">:</span></span><spanclass="n"><spanclass="pre">Type</span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">service</span></span><spanclass="p"><spanclass="pre">:</span></span><spanclass="n"><spanclass="pre">Optional</span><spanclass="p"><spanclass="pre">[</span></span><spanclass="pre">collections.abc.Callable</span><spanclass="p"><spanclass="pre">]</span></span></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="default_value"><spanclass="pre">None</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#cpl.dependency_injection.service_collection_abc.ServiceCollectionABC.add_scoped"title="Permalink to this definition">¶</a></dt>
<emclass="property"><spanclass="pre">abstract</span></em><codeclass="sig-name descname"><spanclass="pre">add_singleton</span></code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">service_type</span></span><spanclass="p"><spanclass="pre">:</span></span><spanclass="n"><spanclass="pre">Type</span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">service</span></span><spanclass="p"><spanclass="pre">:</span></span><spanclass="n"><spanclass="pre">Optional</span><spanclass="p"><spanclass="pre">[</span></span><spanclass="pre">collections.abc.Callable</span><spanclass="p"><spanclass="pre">]</span></span></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="default_value"><spanclass="pre">None</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#cpl.dependency_injection.service_collection_abc.ServiceCollectionABC.add_singleton"title="Permalink to this definition">¶</a></dt>
<emclass="property"><spanclass="pre">abstract</span></em><codeclass="sig-name descname"><spanclass="pre">add_transient</span></code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">service_type</span></span><spanclass="p"><spanclass="pre">:</span></span><spanclass="n"><spanclass="pre">Type</span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">service</span></span><spanclass="p"><spanclass="pre">:</span></span><spanclass="n"><spanclass="pre">Optional</span><spanclass="p"><spanclass="pre">[</span></span><spanclass="pre">collections.abc.Callable</span><spanclass="p"><spanclass="pre">]</span></span></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="default_value"><spanclass="pre">None</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#cpl.dependency_injection.service_collection_abc.ServiceCollectionABC.add_transient"title="Permalink to this definition">¶</a></dt>
<emclass="property"><spanclass="pre">abstract</span></em><codeclass="sig-name descname"><spanclass="pre">build_service_provider</span></code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span>→<aclass="reference internal"href="#cpl.dependency_injection.service_provider_abc.ServiceProviderABC"title="cpl.dependency_injection.service_provider_abc.ServiceProviderABC"><spanclass="pre">cpl.dependency_injection.service_provider_abc.ServiceProviderABC</span></a><aclass="headerlink"href="#cpl.dependency_injection.service_collection_abc.ServiceCollectionABC.build_service_provider"title="Permalink to this definition">¶</a></dt>
<dd><p>Creates instance of the service provider</p>
<spanid="cpl-dependency-injection-service-descriptor"></span><h2>cpl.dependency_injection.service_descriptor<aclass="headerlink"href="#module-cpl.dependency_injection.service_descriptor"title="Permalink to this headline">¶</a></h2>
<emclass="property"><spanclass="pre">class</span></em><codeclass="sig-prename descclassname"><spanclass="pre">cpl.dependency_injection.service_descriptor.</span></code><codeclass="sig-name descname"><spanclass="pre">ServiceDescriptor</span></code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">implementation</span></span><spanclass="p"><spanclass="pre">:</span></span><spanclass="n"><spanclass="pre">Optional</span><spanclass="p"><spanclass="pre">[</span></span><spanclass="pre">Union</span><spanclass="p"><spanclass="pre">[</span></span><spanclass="pre">type</span><spanclass="p"><spanclass="pre">,</span></span><spanclass="pre">object</span><spanclass="p"><spanclass="pre">]</span></span><spanclass="p"><spanclass="pre">]</span></span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">lifetime</span></span><spanclass="p"><spanclass="pre">:</span></span><spanclass="n"><aclass="reference internal"href="#cpl.dependency_injection.service_lifetime_enum.ServiceLifetimeEnum"title="cpl.dependency_injection.service_lifetime_enum.ServiceLifetimeEnum"><spanclass="pre">cpl.dependency_injection.service_lifetime_enum.ServiceLifetimeEnum</span></a></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#cpl.dependency_injection.service_descriptor.ServiceDescriptor"title="Permalink to this definition">¶</a></dt>
<emclass="property"><spanclass="pre">property</span></em><codeclass="sig-name descname"><spanclass="pre">implementation</span></code><aclass="headerlink"href="#cpl.dependency_injection.service_descriptor.ServiceDescriptor.implementation"title="Permalink to this definition">¶</a></dt>
<emclass="property"><spanclass="pre">property</span></em><codeclass="sig-name descname"><spanclass="pre">lifetime</span></code><aclass="headerlink"href="#cpl.dependency_injection.service_descriptor.ServiceDescriptor.lifetime"title="Permalink to this definition">¶</a></dt>
<emclass="property"><spanclass="pre">property</span></em><codeclass="sig-name descname"><spanclass="pre">service_type</span></code><aclass="headerlink"href="#cpl.dependency_injection.service_descriptor.ServiceDescriptor.service_type"title="Permalink to this definition">¶</a></dt>
<spanid="cpl-dependency-injection-service-lifetime-enum"></span><h2>cpl.dependency_injection.service_lifetime_enum<aclass="headerlink"href="#module-cpl.dependency_injection.service_lifetime_enum"title="Permalink to this headline">¶</a></h2>
<emclass="property"><spanclass="pre">class</span></em><codeclass="sig-prename descclassname"><spanclass="pre">cpl.dependency_injection.service_lifetime_enum.</span></code><codeclass="sig-name descname"><spanclass="pre">ServiceLifetimeEnum</span></code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">value</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#cpl.dependency_injection.service_lifetime_enum.ServiceLifetimeEnum"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname"><spanclass="pre">scoped</span></code><emclass="property"><spanclass="pre">=</span><spanclass="pre">1</span></em><aclass="headerlink"href="#cpl.dependency_injection.service_lifetime_enum.ServiceLifetimeEnum.scoped"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname"><spanclass="pre">singleton</span></code><emclass="property"><spanclass="pre">=</span><spanclass="pre">0</span></em><aclass="headerlink"href="#cpl.dependency_injection.service_lifetime_enum.ServiceLifetimeEnum.singleton"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname"><spanclass="pre">transient</span></code><emclass="property"><spanclass="pre">=</span><spanclass="pre">2</span></em><aclass="headerlink"href="#cpl.dependency_injection.service_lifetime_enum.ServiceLifetimeEnum.transient"title="Permalink to this definition">¶</a></dt>
<spanid="cpl-dependency-injection-service-provider"></span><h2>cpl.dependency_injection.service_provider<aclass="headerlink"href="#module-cpl.dependency_injection.service_provider"title="Permalink to this headline">¶</a></h2>
<emclass="property"><spanclass="pre">class</span></em><codeclass="sig-prename descclassname"><spanclass="pre">cpl.dependency_injection.service_provider.</span></code><codeclass="sig-name descname"><spanclass="pre">ServiceProvider</span></code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">service_descriptors</span></span><spanclass="p"><spanclass="pre">:</span></span><spanclass="n"><spanclass="pre">list</span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">config</span></span><spanclass="p"><spanclass="pre">:</span></span><spanclass="n"><aclass="reference internal"href="cpl.configuration.html#cpl.configuration.configuration_abc.ConfigurationABC"title="cpl.configuration.configuration_abc.ConfigurationABC"><spanclass="pre">cpl.configuration.configuration_abc.ConfigurationABC</span></a></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">db_context</span></span><spanclass="p"><spanclass="pre">:</span></span><spanclass="n"><spanclass="pre">Optional</span><spanclass="p"><spanclass="pre">[</span></span><aclass="reference internal"href="cpl.database.context.html#cpl.database.context.database_context_abc.DatabaseContextABC"title="cpl.database.context.database_context_abc.DatabaseContextABC"><spanclass="pre">cpl.database.context.database_context_abc.DatabaseContextABC</span></a><spanclass="p"><spanclass="pre">]</span></span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#cpl.dependency_injection.service_provider.ServiceProvider"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname"><spanclass="pre">build_service</span></code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">service_type</span></span><spanclass="p"><spanclass="pre">:</span></span><spanclass="n"><spanclass="pre">type</span></span></em><spanclass="sig-paren">)</span>→<spanclass="pre">object</span><aclass="headerlink"href="#cpl.dependency_injection.service_provider.ServiceProvider.build_service"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname"><spanclass="pre">get_service</span></code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">service_type</span></span><spanclass="p"><spanclass="pre">:</span></span><spanclass="n"><spanclass="pre">type</span></span></em><spanclass="sig-paren">)</span>→<spanclass="pre">Optional</span><spanclass="p"><spanclass="pre">[</span></span><spanclass="pre">collections.abc.Callable</span><spanclass="p"><spanclass="pre">[</span></span><spanclass="pre">object</span><spanclass="p"><spanclass="pre">]</span></span><spanclass="p"><spanclass="pre">]</span></span><aclass="headerlink"href="#cpl.dependency_injection.service_provider.ServiceProvider.get_service"title="Permalink to this definition">¶</a></dt>
<spanid="cpl-dependency-injection-service-provider-abc"></span><h2>cpl.dependency_injection.service_provider_abc<aclass="headerlink"href="#module-cpl.dependency_injection.service_provider_abc"title="Permalink to this headline">¶</a></h2>
<emclass="property"><spanclass="pre">class</span></em><codeclass="sig-prename descclassname"><spanclass="pre">cpl.dependency_injection.service_provider_abc.</span></code><codeclass="sig-name descname"><spanclass="pre">ServiceProviderABC</span></code><aclass="headerlink"href="#cpl.dependency_injection.service_provider_abc.ServiceProviderABC"title="Permalink to this definition">¶</a></dt>
<emclass="property"><spanclass="pre">abstract</span></em><codeclass="sig-name descname"><spanclass="pre">build_service</span></code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">service_type</span></span><spanclass="p"><spanclass="pre">:</span></span><spanclass="n"><spanclass="pre">type</span></span></em><spanclass="sig-paren">)</span>→<spanclass="pre">object</span><aclass="headerlink"href="#cpl.dependency_injection.service_provider_abc.ServiceProviderABC.build_service"title="Permalink to this definition">¶</a></dt>
<emclass="property"><spanclass="pre">abstract</span></em><codeclass="sig-name descname"><spanclass="pre">get_service</span></code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">instance_type</span></span><spanclass="p"><spanclass="pre">:</span></span><spanclass="n"><spanclass="pre">Type</span></span></em><spanclass="sig-paren">)</span>→<spanclass="pre">Optional</span><spanclass="p"><spanclass="pre">[</span></span><spanclass="pre">collections.abc.Callable</span><spanclass="p"><spanclass="pre">[</span></span><spanclass="pre">object</span><spanclass="p"><spanclass="pre">]</span></span><spanclass="p"><spanclass="pre">]</span></span><aclass="headerlink"href="#cpl.dependency_injection.service_provider_abc.ServiceProviderABC.get_service"title="Permalink to this definition">¶</a></dt>