Class DependencyResolver
- Namespace
- Dynamicweb.Extensibility.Dependencies
- Assembly
- Dynamicweb.Core.dll
Global dependency resolver accessible via the static Current property.
public abstract class DependencyResolver : IServiceProvider
- Inheritance
-
DependencyResolver
- Implements
- Inherited Members
Remarks
This is essentially what is known as an 'anti-pattern' in DI/IoC, so please take that into consideration.
Only use this in places where constructor injection is not possible -
Properties
Current
The current dependency resolver.
Implements IServiceProvider, so usage of extension method from the 'Microsoft.Extensions.DependencyInjection' namespace is possible.
public static DependencyResolver Current { get; set; }
Property Value
Remarks
Exceptions
- DependencyResolverException
Thrown if the dependency resolver is not initialized.
Methods
GetService(Type)
Gets the service object of the specified type.
public abstract object? GetService(Type serviceType)
Parameters
serviceTypeTypeAn object that specifies the type of service object to get.