Dependency Injection
Services can be conditionally injected, or conditionally decorate existing services.
AddTransient / AddScoped
services.AddTransientForFeature<ILinkService, GlobalLinkService>("GlobalLink");
Decorate
The decorator pattern injects the existing implementation of a service into the constructor of the decorator service
services.AddScoped<ITaxService, LocalTaxService>();
services.DecorateForFeature<ITaxService, AvalaraTaxService>("Avalara");
Last updated
Was this helpful?