public void Start<TModuleProvider>(string connectionString, string applicationName) where TModuleProvider:ModuleBase{ try { _domain = AppDomain.CreateDomain("Server"); _starter = (WorkflowServerStarter)_domain.CreateInstanceAndUnwrap( Assembly.GetEntryAssembly().FullName, GetType().FullName ?? throw new InvalidOperationException()); _starter.OnServerDomainCustomHandleException += StarterOnOnServerDomainCustomHandleException; var workflowServerEventArgs = new WorkflowServerEventArgs(); OnWorkflowServerRequested(workflowServerEventArgs); _starter.StartOnServerDomain<TModuleProvider>(connectionString, applicationName); } catch (Exception e) { Tracing.Tracer.LogError(e); OnCustomHandleException?.Invoke(null, new ExceptionEventArgs("Exception occurs:\r\n\r\n" + e.Message)); } }
void StarterOnOnServerDomainCustomHandleException(object sender, ExceptionEventArgs e){ OnCustomHandleException?.Invoke(null, e); }