BindToTypePolicy.QueryAssemblyLoadEventArgs.Assembly Property
Gets or sets the assembly.
Namespace: DevExpress.Utils
Assembly: DevExpress.Data.v24.1.dll
NuGet Package: DevExpress.Data
Declaration
Property Value
Type | Description |
---|---|
Assembly | The assembly. |
Remarks
The following example loads a specific version from multiple versions of an assembly:
using System;
using System.IO;
using System.Reflection;
using System.Windows.Forms;
namespace DXApplication21 {
internal static class Program {
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main() {
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
DevExpress.Utils.BindToTypePolicy.QueryAssemblyLoad += BindToTypePolicy_QueryAssemblyLoad;
Application.Run(new Form1());
}
private static void BindToTypePolicy_QueryAssemblyLoad(object sender, DevExpress.Utils.BindToTypePolicy.QueryAssemblyLoadEventArgs e) {
if (e.AssemblyName.StartsWith("EntityFramework", StringComparison.OrdinalIgnoreCase)) {
// Loads a specific assembly version distributed with the application.
var appDirectory = Path.GetDirectoryName(typeof(Program).Assembly.Location);
string path = Path.Combine(appDirectory, @"..\\Lib", "EntityFramework.dll");
e.Assembly = Assembly.LoadFrom(path);
}
}
}
}
See Also