/// <summary> /// 执行外部方法 /// </summary> /// <param name="service">Action实体</param> /// <param name="delegateService">委托服务</param> private static void ExecuteStoreProcedureMethod(ServiceEntity service, IDelegateService delegateService) { try { var parameters = CompositeSqlParametersValue(service.Arguments, delegateService); var procedureName = service.Expression; var session = delegateService.GetSession(); var repository = new Repository(); repository.ExecuteProc(session.Connection, procedureName, parameters, session.Transaction); } catch (System.Exception ex) { throw new WorkflowException(LocalizeHelper.GetEngineMessage("actionexecutor.ExecuteStoreProcedureMethod.exception", ex.Message)); } }
/// <summary> /// 执行外部方法 /// </summary> /// <param name="action">Action实体</param> /// <param name="delegateService">委托服务</param> private static void ExecuteStoreProcedureMethod(ActionEntity action, IDelegateService delegateService) { try { var parameters = CompositeSqlParametersValue(action.Arguments, delegateService); var procedureName = action.Expression; var session = delegateService.GetSession(); var repository = new Repository(); repository.ExecuteProc(session.Connection, procedureName, parameters, session.Transaction); } catch (System.Exception ex) { throw new WorkflowException(string.Format("执行StoreProcedure方法出错:{0}", ex.Message)); } }
/// <summary> /// 执行外部方法 /// </summary> /// <param name="service">Action实体</param> /// <param name="delegateService">委托服务</param> private static void ExecuteSQLMethod(ServiceEntity service, IDelegateService delegateService) { try { var parameters = CompositeSqlParametersValue(service.Arguments, delegateService); if (service.CodeInfo != null && !string.IsNullOrEmpty(service.CodeInfo.CodeText)) { //var sqlScript = action.Expression; var sqlScript = service.CodeInfo.CodeText; //modified by Besley in 12/26/2019, body is nodetext rather than attribute var session = delegateService.GetSession(); var repository = new Repository(); repository.Execute(session.Connection, sqlScript, parameters, session.Transaction); } else { throw new WorkflowException(LocalizeHelper.GetEngineMessage("actionexecutor.ExecuteSQLMethod.warn")); } } catch (System.Exception ex) { throw new WorkflowException(LocalizeHelper.GetEngineMessage("actionexecutor.ExecuteSQLMethod.exception", ex.Message)); } }
/// <summary> /// 执行外部方法 /// </summary> /// <param name="action">Action实体</param> /// <param name="delegateService">委托服务</param> private static void ExecuteSQLMethod(ActionEntity action, IDelegateService delegateService) { try { var parameters = CompositeSqlParametersValue(action.Arguments, delegateService); if (action.CodeInfo != null && !string.IsNullOrEmpty(action.CodeInfo.CodeText)) { //var sqlScript = action.Expression; var sqlScript = action.CodeInfo.CodeText; //modified by Besley in 12/26/2019, body is nodetext rather than attribute var session = delegateService.GetSession(); var repository = new Repository(); repository.Execute(session.Connection, sqlScript, parameters, session.Transaction); } else { throw new WorkflowException("SQL脚本为空, 不能执行!"); } } catch (System.Exception ex) { throw new WorkflowException(string.Format("执行SQL脚本时出错:{0}", ex.Message)); } }