/// <summary> /// This method links to the MySQL assembly, ensuring that the /// assembly is loaded. If necessary the assembly is loaded from the /// NWNX4 installation directory. /// </summary> /// <param name="ConnectionString">Optionally supplies an overload /// connection string. If null, the default string is built from the /// NWNX MySQL plugin's configuration file.</param> /// <param name="Dedicated">Supplies true if the database object is to /// use a dedicated connection.</param> private void LinkToMySQLAssembly(string ConnectionString = null, bool Dedicated = false) { AppDomain CurrentDomain = AppDomain.CurrentDomain; MySQLAssembly = SystemInfo.LoadAssemblyFromNWNX4("MySql.Data.dll"); CurrentDomain.AssemblyResolve += new ResolveEventHandler(LinkToMySQLAssembly_AssemblyResolve); try { ForceLoadMySQL(); } finally { CurrentDomain.AssemblyResolve -= new ResolveEventHandler(LinkToMySQLAssembly_AssemblyResolve); } Implementation = new MySQLDatabaseInternal(ConnectionString, Dedicated); }
/// <summary> /// This method links to the MySQL assembly, ensuring that the /// assembly is loaded. If necessary the assembly is loaded from the /// NWNX4 installation directory. /// </summary> /// <param name="ConnectionString">Optionally supplies an overload /// connection string. If null, the default string is built from the /// NWNX MySQL plugin's configuration file.</param> private void LinkToMySQLAssembly(string ConnectionString = null) { AppDomain CurrentDomain = AppDomain.CurrentDomain; MySQLAssembly = SystemInfo.LoadAssemblyFromNWNX4("MySql.Data.dll"); CurrentDomain.AssemblyResolve += new ResolveEventHandler(LinkToMySQLAssembly_AssemblyResolve); try { ForceLoadMySQL(); } finally { CurrentDomain.AssemblyResolve -= new ResolveEventHandler(LinkToMySQLAssembly_AssemblyResolve); } Implementation = new MySQLDatabaseInternal(ConnectionString); }