public static CoreControler Create() { AppDomain domain = AppDomainFactory.Create("AgentCore"); Assembly asm = Assembly.GetAssembly(typeof(CoreFactory)); CoreInitializer initializer = (CoreInitializer)domain.CreateInstanceFromAndUnwrap( typeof(CoreInitializer).Assembly.Location, typeof(CoreInitializer).FullName); Guid coreId = initializer.Id; if (coreId == Guid.Empty) { AppDomain.Unload(domain); throw new Exception("Error in CoreInitializer"); } _cores.AddOrUpdate(coreId, new CoreFactoryItem(domain, initializer, null), (id, tuple) => tuple); CoreControler remoteControl = new CoreControler(coreId); remoteControl.OnDispose += Destroy; return(remoteControl); }
public CoreFactoryItem(AppDomain domain, CoreInitializer initializer, ILog logger) { Domain = domain; Initializer = initializer; Logger = logger; }