Table of Contents

Class AddInLoadContext

Namespace
Dynamicweb.Extensibility.AddIns
Assembly
Dynamicweb.Core.dll

A custom AssemblyLoadContext implementation for loading addins.

public sealed class AddInLoadContext : AssemblyLoadContext
Inheritance
AddInLoadContext
Inherited Members

Methods

Create(string)

Creates a new AddInLoadContext instance from the given addin path.

public static AddInLoadContext Create(string addinPath)

Parameters

addinPath string

The path to the addin to load into the context.

Returns

AddInLoadContext

A new context instance.

Create(string, string?)

Creates a new AddInLoadContext instance from the given addin path.

public static AddInLoadContext Create(string addinPath, string? name)

Parameters

addinPath string

The path to the addin to load into the context.

name string

The name of the context.

Returns

AddInLoadContext

A new context instance.

Create(string, string?, string?)

Creates a new AddInLoadContext instance from the given addin path.

public static AddInLoadContext Create(string addinPath, string? resolverPath, string? name)

Parameters

addinPath string

The path to the addin to load into the context.

resolverPath string

The path to use for resolving dependencies.

name string

The name of the context.

Returns

AddInLoadContext

A new context instance.

Exceptions

ArgumentNullException

If addinPath is null.

ArgumentException

If addinPath is the empty string.

FileNotFoundException

If the addin file doesn't exist.

DirectoryNotFoundException

If the resolver path is given but doesn't exist.

InvalidOperationException

If the name of the addin folder cannot be determined from the path.

CreateFromFolderPath(string)

Creates a AddInLoadContext instance if the specified path is a valid addin folder.

public static AddInLoadContext CreateFromFolderPath(string path)

Parameters

path string

The path of the folder to load addins from

Returns

AddInLoadContext

A new context instance.

Exceptions

ArgumentNullException

If path is null.

ArgumentException

If path is the empty string.

DirectoryNotFoundException

If the given path doesn't exist.

FileNotFoundException

If no primary addin could be found in the folder.

GetAssemblyBytes()

Gets the bytes of the primary assembly loaded into the context.

public byte[] GetAssemblyBytes()

Returns

byte[]

GetPrimaryAssembly()

Gets the primary assembly loaded into the context.

public Assembly GetPrimaryAssembly()

Returns

Assembly

Load(AssemblyName)

When overridden in a derived class, allows an assembly to be resolved based on its AssemblyName.

protected override Assembly? Load(AssemblyName assemblyName)

Parameters

assemblyName AssemblyName

The object that describes the assembly to be resolved.

Returns

Assembly

The resolved assembly, or null.

TryCreateFromFolderPath(string)

Tries to create a AddInLoadContext instance if the specified path is a valid addin folder.

public static AddInLoadContext? TryCreateFromFolderPath(string path)

Parameters

path string

The path of the folder to load addins from

Returns

AddInLoadContext

A new context instance or null.

To top