public bool LoadAppDomain(ISearchPath searchPath) { try { if (customConfigAssemblyInspector == null) { customConfigAssemblyInspector = CreateAppDomain(); } if (searchPath.Paths.Any()) { if (!customConfigAssemblyInspector.LoadAssembly(searchPath)) { AppDomain.Unload(workerAppDomain); workerAppDomain = null; CustomConfigInspectorObject.ClearAll(); return(false); } } return(true); } catch (Exception) { return(false); } }
private ICustomConfigAssemblyInspector CreateAppDomain() { AppDomainSetup setup = new AppDomainSetup(); #if DEBUG setup.ApplicationBase = @"E:\db4object\db4o\Trunk\omn\OMADDIN\bin\"; #else setup.ApplicationBase = CommonForAppDomain.GetPath() + "\\"; #endif setup.ShadowCopyDirectories = Path.GetTempPath(); setup.ShadowCopyFiles = "true"; workerAppDomain = AppDomain.CreateDomain("CustomConfigWorkerAppDomain", null, setup); AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(CurrentDomain_AssemblyResolve); object anObject = workerAppDomain.CreateInstanceAndUnwrap("OMCustomConfigImplementation", "OMCustomConfigImplementation.CustomConfigAssemblyInfo.CustomConfigAssemblyInspector"); ICustomConfigAssemblyInspector customConfigAssemblyInspector = anObject as ICustomConfigAssemblyInspector; object anObject1 = workerAppDomain.CreateInstanceAndUnwrap("OMCustomConfigImplementation", "OMCustomConfigImplementation.UserCustomConfig.UserConfig"); IUserConfig conn = anObject1 as IUserConfig; CustomConfigInspectorObject.CustomUserConfig = conn; return(customConfigAssemblyInspector); }
public bool LoadAppDomain(ISearchPath searchPath) { try { if (customConfigAssemblyInspector == null) customConfigAssemblyInspector = CreateAppDomain(); if (searchPath.Paths.Any()) { if (!customConfigAssemblyInspector.LoadAssembly(searchPath)) { AppDomain.Unload(workerAppDomain); workerAppDomain = null; CustomConfigInspectorObject.ClearAll(); return false; } } return true; } catch (Exception) { return false; } }
public bool LoadAppDomain(string searchPath) { if (customConfigAssemblyInspector == null) customConfigAssemblyInspector = CreateAppDomain(); customConfigAssemblyInspector.LoadAssembly(searchPath); bool check = CustomConfigInspectorObject.CustomUserConfig.CheckIfCustomConfigImplemented(checkLocal); UnloadCustomConfigAppDomain(); return check; }
public bool LoadAppDomain(string searchPath) { if (customConfigAssemblyInspector == null) { customConfigAssemblyInspector = CreateAppDomain(); } customConfigAssemblyInspector.LoadAssembly(searchPath); bool check = CustomConfigInspectorObject.CustomUserConfig.CheckIfCustomConfigImplemented(checkLocal); UnloadCustomConfigAppDomain(); return(check); }
public static void ClearAll() { CustomConfigAssemblyInspector = null; CustomUserConfig = null; }