/// <summary> /// 根据一组Operation Key的定义产生一组ServiceOperation类 /// </summary> /// <param name="invokeWhenPersist">是否是持久化时调用</param> /// <param name="opKeys"></param> /// <returns></returns> public WfServiceOperationDefinitionCollection GetOperations(bool invokeWhenPersist, params string[] opKeys) { WfServiceOperationDefinitionCollection result = new WfServiceOperationDefinitionCollection(); if (opKeys != null) { foreach (string opKey in opKeys) { if (opKey.IsNotEmpty()) { string key = opKey.Trim(); if (key.IsNotEmpty()) { WfServiceOperationDefinitionConfigurationElement opElement = this.Operations[key]; if (opElement != null) { if (opElement.InvokeWhenPersist == invokeWhenPersist) result.Add(new WfServiceOperationDefinition(opElement)); } } } } } return result; }
protected override WfServiceOperationDefinitionCollection GetOperationsWhenPersist() { WfServiceOperationDefinitionCollection result = this._Process.Descriptor.CancelBeforeExecuteServices.GetServiceOperationsWhenPersist(); result.CopyFrom(this._Process.Descriptor.CancelAfterExecuteServices.GetServiceOperationsWhenPersist()); return(result); }
/// <summary> /// 调用远程服务 /// </summary> /// <param name="operations"></param> protected void InvokeServiceOperations(WfServiceOperationDefinitionCollection operations) { foreach (WfServiceOperationDefinition svcDefinition in operations) { WfServiceInvoker svcInvoker = new WfServiceInvoker(svcDefinition); svcInvoker.Invoke(this.GetApplicationRuntimeParameters()); } }
/// <summary> /// 得到在持久化时需要调用的服务,包括配置文件中定义的 /// </summary> /// <returns></returns> private WfServiceOperationDefinitionCollection GetAllOperationsWhenPersist() { WfServiceOperationDefinitionCollection result = this.GetOperationsWhenPersist(); string opKeys = this.GetInvokeServiceKeys(); if (opKeys.IsNotEmpty()) { result.CopyFrom(WfServiceDefinitionSettings.GetSection().GetOperations(true, opKeys)); } return(result); }
/// <summary> /// 得到在持久化之前需要调用的服务,包括配置文件中定义的 /// </summary> /// <returns></returns> private WfServiceOperationDefinitionCollection GetAllOperationsBeforePersist() { WfServiceOperationDefinitionCollection result = this.GetOperationsBeforePersist(); string opKeys = this.GetInvokeServiceKeys(); if (opKeys.IsNotEmpty()) { result.CopyFrom(WfServiceDefinitionSettings.GetSection().GetOperations(false, opKeys.Split(Splitter, StringSplitOptions.RemoveEmptyEntries))); } return(result); }
private static WfServiceOperationDefinitionCollection GetDeserilizedServiceDefs(string data) { WfServiceOperationDefinitionCollection result = null; if (data.IsNotEmpty()) { XElement root = XElement.Parse(data); XElementFormatter formatter = new XElementFormatter(); result = (WfServiceOperationDefinitionCollection)formatter.Deserialize(root); } return(result); }
public override void AfterLoad() { if (this.Data.IsNotEmpty()) { XmlDocument xmlDoc = XmlHelper.CreateDomDocument(this.Data); string serilizedSvcDefData = XmlHelper.GetSingleNodeText(xmlDoc.DocumentElement, "SvcOperationDefs"); this._SvcOperationDefs = GetDeserilizedServiceDefs(serilizedSvcDefData); string serilizedContextData = XmlHelper.GetSingleNodeText(xmlDoc.DocumentElement, "ContextData"); Dictionary<string, object> contextData = GetDeserilizedContextData(serilizedContextData); if (contextData != null) { foreach (KeyValuePair<string, object> kp in contextData) { this.Context[kp.Key] = kp.Value; } } } }
public override void AfterLoad() { if (this.Data.IsNotEmpty()) { XmlDocument xmlDoc = XmlHelper.CreateDomDocument(this.Data); string serilizedSvcDefData = XmlHelper.GetSingleNodeText(xmlDoc.DocumentElement, "SvcOperationDefs"); this._SvcOperationDefs = GetDeserilizedServiceDefs(serilizedSvcDefData); string serilizedContextData = XmlHelper.GetSingleNodeText(xmlDoc.DocumentElement, "ContextData"); Dictionary <string, object> contextData = GetDeserilizedContextData(serilizedContextData); if (contextData != null) { foreach (KeyValuePair <string, object> kp in contextData) { this.Context[kp.Key] = kp.Value; } } } }
private static string GetSerilizedServiceDefs(WfServiceOperationDefinitionCollection svcOperationDefs) { XElementFormatter formatter = new XElementFormatter(); return formatter.Serialize(svcOperationDefs).ToString(); }
private static string GetSerilizedServiceDefs(WfServiceOperationDefinitionCollection svcOperationDefs) { XElementFormatter formatter = new XElementFormatter(); return(formatter.Serialize(svcOperationDefs).ToString()); }