Table of Contents

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

DependencyResolver

Remarks

Only use this in places where constructor injection is not possible -

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

serviceType Type

An object that specifies the type of service object to get.

Returns

object

A service object of type serviceType.

-or-

null if there is no service object of type serviceType.

To top