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
stringThe 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
stringThe path to the addin to load into the context.
name
stringThe 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
stringThe path to the addin to load into the context.
resolverPath
stringThe path to use for resolving dependencies.
name
stringThe name of the context.
Returns
- AddInLoadContext
A new context instance.
Exceptions
- ArgumentNullException
If
addinPath
isnull
.- 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
stringThe path of the folder to load addins from
Returns
- AddInLoadContext
A new context instance.
Exceptions
- ArgumentNullException
If
path
isnull
.- 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
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
AssemblyNameThe object that describes the assembly to be resolved.
Returns
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
stringThe path of the folder to load addins from
Returns
- AddInLoadContext
A new context instance or
null
.