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
addinPathstringThe 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
addinPathstringThe path to the addin to load into the context.
namestringThe 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
addinPathstringThe path to the addin to load into the context.
resolverPathstringThe path to use for resolving dependencies.
namestringThe name of the context.
Returns
- AddInLoadContext
A new context instance.
Exceptions
- ArgumentNullException
If
addinPathisnull.- ArgumentException
If
addinPathis 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
pathstringThe path of the folder to load addins from
Returns
- AddInLoadContext
A new context instance.
Exceptions
- ArgumentNullException
If
pathisnull.- ArgumentException
If
pathis 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
assemblyNameAssemblyNameThe 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
pathstringThe path of the folder to load addins from
Returns
- AddInLoadContext
A new context instance or
null.