C# Class AppDomainToolkit.AssemblyLoader

This class will load assemblies into whatever application domain it's loaded into. It's just a simple convenience wrapper around the static Assembly.Load* methods, with the main benefit being the ability to load an assembly anonymously bitwise. When you load the assembly this way, there won't be any locking of the DLL file.
Inheritance: System.MarshalByRefObject, IAssemblyLoader
ファイルを表示 Open project: jduv/AppDomainToolkit

Public Methods

Method Description
GetAssemblies ( ) : System.Reflection.Assembly[] Just a simple call to AppDomain.CurrentDomain.GetAssemblies(), nothing more.
LoadAssembly ( LoadMethod loadMethod, string assemblyPath, string pdbPath = null ) : Assembly If the LoadMethod for this instance is set to LoadBits and the path to the PDB file is unspecified then we will attempt to guess the path to the PDB and load it. Note that if an assembly is loaded into memory without it's debugging symbols then an image exception will be thrown. Be wary of this. Loading an Assembly with the LoadBits method will not lock the DLL file because the entire assembly is loaded into memory and the file handle is closed. Note that, however, Assemblies loaded in this manner will not have a location associated with them--so you must then key the Assembly by it's strong name. This can cause problems when loading multiple versions of the same assembly into a single application domain.
LoadAssemblyWithReferences ( LoadMethod loadMethod, string assemblyPath ) : IList This implementation will perform a best-effort load of the target assembly and it's required references into the current application domain. The .NET framework pins us in on which call we're allowed to use when loading these assemblies, so we'll need to rely on the AssemblyResolver instance attached to the AppDomain in order to load the way we want.

Method Details

GetAssemblies() public method

Just a simple call to AppDomain.CurrentDomain.GetAssemblies(), nothing more.
public GetAssemblies ( ) : System.Reflection.Assembly[]
return System.Reflection.Assembly[]

LoadAssembly() public method

If the LoadMethod for this instance is set to LoadBits and the path to the PDB file is unspecified then we will attempt to guess the path to the PDB and load it. Note that if an assembly is loaded into memory without it's debugging symbols then an image exception will be thrown. Be wary of this. Loading an Assembly with the LoadBits method will not lock the DLL file because the entire assembly is loaded into memory and the file handle is closed. Note that, however, Assemblies loaded in this manner will not have a location associated with them--so you must then key the Assembly by it's strong name. This can cause problems when loading multiple versions of the same assembly into a single application domain.
public LoadAssembly ( LoadMethod loadMethod, string assemblyPath, string pdbPath = null ) : Assembly
loadMethod LoadMethod
assemblyPath string
pdbPath string
return System.Reflection.Assembly

LoadAssemblyWithReferences() public method

This implementation will perform a best-effort load of the target assembly and it's required references into the current application domain. The .NET framework pins us in on which call we're allowed to use when loading these assemblies, so we'll need to rely on the AssemblyResolver instance attached to the AppDomain in order to load the way we want.
public LoadAssemblyWithReferences ( LoadMethod loadMethod, string assemblyPath ) : IList
loadMethod LoadMethod
assemblyPath string
return IList