|
|
|
@ -96,7 +96,7 @@ public class TaxCalculator : ITransientDependency |
|
|
|
Another way of configuring a service for dependency injection is to use ``DependencyAttribute``. It has the following properties: |
|
|
|
|
|
|
|
* ``Lifetime``: Lifetime of the registration: ``Singleton``, ``Transient`` or ``Scoped``. |
|
|
|
* ``TryRegister``: Set ``true`` to register the service only it's not registered before. Uses TryAdd... extension methods of IServiceCollection. |
|
|
|
* ``TryRegister``: Set ``true`` to register the service only if it's not registered before. Uses TryAdd... extension methods of IServiceCollection. |
|
|
|
* ``ReplaceServices``: Set ``true`` to replace services if they are already registered before. Uses Replace extension method of IServiceCollection. |
|
|
|
|
|
|
|
Example: |
|
|
|
|