/// <summary> /// Gets the needed variables. /// </summary> /// <param name="variableDispenser">The variable dispenser.</param> /// <param name="componentEvents">The component events.</param> private void GetNeededVariables(VariableDispenser variableDispenser, IDTSComponentEvents componentEvents) { bool refire = false; List <string> lockForRead = new List <string>(); { var param = ServiceUrl; componentEvents.FireInformation(0, "SSISWCFTask", "WcfServiceUrl = " + ServiceUrl, string.Empty, 0, ref refire); if (param.Contains("@")) { var regexStr = param.Split('@'); foreach (var nexSplitedVal in regexStr.Where(val => val.Trim().Length != 0).Select(strVal => strVal.Split(new[] { "::" }, StringSplitOptions.RemoveEmptyEntries))) { try { componentEvents.FireInformation(0, "SSISWCFTask", nexSplitedVal[1].Remove(nexSplitedVal[1].IndexOf(']')), string.Empty, 0, ref refire); if (!IsVariableInLockForReadOrWrite(lockForRead, nexSplitedVal[1].Remove(nexSplitedVal[1].IndexOf(']')))) { variableDispenser.LockForRead(nexSplitedVal[1].Remove(nexSplitedVal[1].IndexOf(']'))); } } catch (Exception exception) { throw new Exception(exception.Message); } } } } { var param = ServiceContract; componentEvents.FireInformation(0, "SSISWCFTask", "ServiceContract = " + ServiceContract, string.Empty, 0, ref refire); if (param.Contains("@")) { var regexStr = param.Split('@'); foreach (var nexSplitedVal in regexStr.Where(val => val.Trim().Length != 0).Select(strVal => strVal.Split(new[] { "::" }, StringSplitOptions.RemoveEmptyEntries))) { try { componentEvents.FireInformation(0, "SSISWCFTask", nexSplitedVal[1].Remove(nexSplitedVal[1].IndexOf(']')), string.Empty, 0, ref refire); if (!IsVariableInLockForReadOrWrite(lockForRead, nexSplitedVal[1].Remove(nexSplitedVal[1].IndexOf(']')))) { variableDispenser.LockForRead(nexSplitedVal[1].Remove(nexSplitedVal[1].IndexOf(']'))); } } catch (Exception exception) { throw new Exception(exception.Message); } } } } { var param = OperationContract; componentEvents.FireInformation(0, "SSISWCFTask", "OperationContract = " + OperationContract, string.Empty, 0, ref refire); if (param.Contains("@")) { var regexStr = param.Split('@'); foreach (var nexSplitedVal in regexStr.Where(val => val.Trim().Length != 0).Select(strVal => strVal.Split(new[] { "::" }, StringSplitOptions.RemoveEmptyEntries))) { try { componentEvents.FireInformation(0, "SSISWCFTask", nexSplitedVal[1].Remove(nexSplitedVal[1].IndexOf(']')), string.Empty, 0, ref refire); if (!IsVariableInLockForReadOrWrite(lockForRead, nexSplitedVal[1].Remove(nexSplitedVal[1].IndexOf(']')))) { variableDispenser.LockForRead(nexSplitedVal[1].Remove(nexSplitedVal[1].IndexOf(']'))); } } catch (Exception exception) { throw new Exception(exception.Message); } } } } { if (!string.IsNullOrEmpty(ReturnedValue)) { var param = ReturnedValue; componentEvents.FireInformation(0, "SSISWCFTask", "ReturnedValue = " + ReturnedValue, string.Empty, 0, ref refire); if (param.Contains("@")) { var regexStr = param.Split('@'); foreach (var nexSplitedVal in regexStr.Where(val => val.Trim().Length != 0).Select(strVal => strVal.Split(new[] { "::" }, StringSplitOptions.RemoveEmptyEntries))) { try { componentEvents.FireInformation(0, "SSISWCFTask", nexSplitedVal[1].Remove(nexSplitedVal[1].IndexOf(']')), string.Empty, 0, ref refire); if (!IsVariableInLockForReadOrWrite(lockForRead, nexSplitedVal[1].Remove(nexSplitedVal[1].IndexOf(']')))) { variableDispenser.LockForWrite(nexSplitedVal[1].Remove(nexSplitedVal[1].IndexOf(']'))); } } catch (Exception exception) { throw new Exception(exception.Message); } } } } } componentEvents.FireInformation(0, "SSISWCFTask", "MappingParams ", string.Empty, 0, ref refire); //Get variables for MappingParams foreach (var nexSplitedVal in ((MappingParams)MappingParams) .Where(mappingParam => mappingParam.Value.Contains("@")) .Select(mappingParam => mappingParam.Value.Split('@')) .SelectMany(regexStr => regexStr.Where(val => val.Trim().Length != 0).Select(strVal => strVal.Split(new[] { "::" }, StringSplitOptions.RemoveEmptyEntries)))) { try { componentEvents.FireInformation(0, "SSISWCFTask", nexSplitedVal[1].Remove(nexSplitedVal[1].IndexOf(']')), string.Empty, 0, ref refire); if (!IsVariableInLockForReadOrWrite(lockForRead, nexSplitedVal[1].Remove(nexSplitedVal[1].IndexOf(']')))) { variableDispenser.LockForRead(nexSplitedVal[1].Remove(nexSplitedVal[1].IndexOf(']'))); } } catch { } } variableDispenser.GetVariables(ref _vars); }
/// <summary> /// Gets the needed variables. /// </summary> /// <param name="variableDispenser">The variable dispenser.</param> /// <param name="componentEvents">The component events.</param> private void GetNeededVariables(VariableDispenser variableDispenser, IDTSComponentEvents componentEvents) { bool refire = false; List <string> lockForRead = new List <string>(); try { var param = ServiceUrl; componentEvents.FireInformation(0, "SSISWebServiceTask", "ServiceUrl = " + ServiceUrl, string.Empty, 0, ref refire); if (param.Contains("@")) { var regexStr = param.Split('@'); foreach (var nexSplitedVal in regexStr.Where(val => val.Trim().Length != 0).Select(strVal => strVal.Split(new[] { "::" }, StringSplitOptions.RemoveEmptyEntries))) { try { componentEvents.FireInformation(0, "SSISWebServiceTask", nexSplitedVal[1].Remove(nexSplitedVal[1].IndexOf(']')), string.Empty, 0, ref refire); if (!IsVariableInLockForReadOrWrite(lockForRead, nexSplitedVal[1].Remove(nexSplitedVal[1].IndexOf(']')))) { variableDispenser.LockForRead(nexSplitedVal[1].Remove(nexSplitedVal[1].IndexOf(']'))); } } catch (Exception exception) { throw new Exception(exception.Message); } } } } catch { //We will continue... } try { var param = Service; componentEvents.FireInformation(0, "SSISWebServiceTask", "Service = " + Service, string.Empty, 0, ref refire); if (param.Contains("@")) { var regexStr = param.Split('@'); foreach (var nexSplitedVal in regexStr.Where(val => val.Trim().Length != 0).Select(strVal => strVal.Split(new[] { "::" }, StringSplitOptions.RemoveEmptyEntries))) { try { componentEvents.FireInformation(0, "SSISWebServiceTask", nexSplitedVal[1].Remove(nexSplitedVal[1].IndexOf(']')), string.Empty, 0, ref refire); if (!IsVariableInLockForReadOrWrite(lockForRead, nexSplitedVal[1].Remove(nexSplitedVal[1].IndexOf(']')))) { variableDispenser.LockForRead(nexSplitedVal[1].Remove(nexSplitedVal[1].IndexOf(']'))); } } catch (Exception exception) { throw new Exception(exception.Message); } } } } catch (Exception exception) { throw new Exception(exception.Message); } try { var param = WebMethod; componentEvents.FireInformation(0, "SSISWebServiceTask", "WebMethod = " + WebMethod, string.Empty, 0, ref refire); if (param.Contains("@")) { var regexStr = param.Split('@'); foreach (var nexSplitedVal in regexStr.Where(val => val.Trim().Length != 0).Select(strVal => strVal.Split(new[] { "::" }, StringSplitOptions.RemoveEmptyEntries))) { try { componentEvents.FireInformation(0, "SSISWebServiceTask", nexSplitedVal[1].Remove(nexSplitedVal[1].IndexOf(']')), string.Empty, 0, ref refire); if (!IsVariableInLockForReadOrWrite(lockForRead, nexSplitedVal[1].Remove(nexSplitedVal[1].IndexOf(']')))) { variableDispenser.LockForRead(nexSplitedVal[1].Remove(nexSplitedVal[1].IndexOf(']'))); } } catch (Exception exception) { throw new Exception(exception.Message); } } } } catch (Exception exception) { throw new Exception(exception.Message); } try { if (!string.IsNullOrEmpty(ReturnedValue)) { var param = ReturnedValue; componentEvents.FireInformation(0, "SSISWebServiceTask", "ReturnedValue = " + ReturnedValue, string.Empty, 0, ref refire); if (param.Contains("@")) { var regexStr = param.Split('@'); foreach (var nexSplitedVal in regexStr.Where(val => val.Trim().Length != 0).Select(strVal => strVal.Split(new[] { "::" }, StringSplitOptions.RemoveEmptyEntries))) { try { componentEvents.FireInformation(0, "SSISWebServiceTask", nexSplitedVal[1].Remove(nexSplitedVal[1].IndexOf(']')), string.Empty, 0, ref refire); if (!IsVariableInLockForReadOrWrite(lockForRead, nexSplitedVal[1].Remove(nexSplitedVal[1].IndexOf(']')))) { variableDispenser.LockForWrite(nexSplitedVal[1].Remove(nexSplitedVal[1].IndexOf(']'))); } } catch (Exception exception) { throw new Exception(exception.Message); } } } } } catch (Exception exception) { throw new Exception(exception.Message); } try { componentEvents.FireInformation(0, "SSISWebServiceTask", "MappingParams ", string.Empty, 0, ref refire); //Get variables for MappingParams foreach (var mappingParams in (MappingParams)MappingParams) { try { if (mappingParams.Value.Contains("@")) { var regexStr = mappingParams.Value.Split('@'); foreach (var nexSplitedVal in regexStr.Where(val => val.Trim().Length != 0).Select(strVal => strVal.Split(new[] { "::" }, StringSplitOptions.RemoveEmptyEntries))) { try { componentEvents.FireInformation(0, "SSISWebServiceTask", nexSplitedVal[1].Remove(nexSplitedVal[1].IndexOf(']')), string.Empty, 0, ref refire); if (!IsVariableInLockForReadOrWrite(lockForRead, nexSplitedVal[1].Remove(nexSplitedVal[1].IndexOf(']')))) { variableDispenser.LockForRead(nexSplitedVal[1].Remove(nexSplitedVal[1].IndexOf(']'))); } } catch (Exception exception) { throw new Exception(exception.Message); } } } } catch (Exception exception) { throw new Exception(exception.Message); } } } catch (Exception ex) { componentEvents.FireError(0, "SSISReportGeneratorTask", string.Format("Problem MappingParams: {0} {1}", ex.Message, ex.StackTrace), "", 0); } variableDispenser.GetVariables(ref _vars); }
/// <summary> /// This method recupers all needed variable saved in the component property 'MappingParams' /// </summary> /// <param name="variableDispenser">The variable dispenser.</param> private void GetNeededVariables(VariableDispenser variableDispenser) { List <string> lockForRead = new List <string>(); try { //Get variables for Method parameter var mappedParams = MappingParams.Split(new[] { ";" }, StringSplitOptions.RemoveEmptyEntries); foreach (string mappedParam in mappedParams) { var param = mappedParam.Split('|')[1]; try { if (param.Contains("@")) { var regexStr = param.Split('@'); foreach (var nexSplitedVal in regexStr.Where(val => val.Trim().Length != 0).Select(strVal => strVal.Split(new[] { "::" }, StringSplitOptions.RemoveEmptyEntries))) { if (!IsVariableInLockForReadOrWrite(lockForRead, nexSplitedVal[1].Remove(nexSplitedVal[1].IndexOf(']')))) { variableDispenser.LockForRead(nexSplitedVal[1].Remove(nexSplitedVal[1].IndexOf(']'))); } } } //else // variableDispenser.LockForRead(param); } catch { } } //Get variables for Configuration File if (ConfigurationType == SSISExecuteAssemblyTask100.ConfigurationType.TASK_VARIABLE) { var param = ConfigurationFile; if (param.Contains("@")) { var regexStr = param.Split('@'); foreach (var nexSplitedVal in regexStr.Where(val => val.Trim().Length != 0).Select(strVal => strVal.Split(new[] { "::" }, StringSplitOptions.RemoveEmptyEntries))) { if (!IsVariableInLockForReadOrWrite(lockForRead, nexSplitedVal[1].Remove(nexSplitedVal[1].IndexOf(']')))) { variableDispenser.LockForRead(nexSplitedVal[1].Remove(nexSplitedVal[1].IndexOf(']'))); } } } else { variableDispenser.LockForRead(param); } } //Get variable for out put variable // Lock it for "write" if (!string.IsNullOrEmpty(OutPutVariable)) { if (OutPutVariable.Contains("@")) { var regexStr = OutPutVariable.Split('@'); foreach (var nexSplitedVal in regexStr.Where(val => val.Trim().Length != 0).Select(strVal => strVal.Split(new[] { "::" }, StringSplitOptions.RemoveEmptyEntries))) { if (!IsVariableInLockForReadOrWrite(lockForRead, nexSplitedVal[1].Remove(nexSplitedVal[1].IndexOf(']')))) { variableDispenser.LockForWrite(nexSplitedVal[1].Remove(nexSplitedVal[1].IndexOf(']'))); } } } } } catch (Exception) { //We will continue... } variableDispenser.GetVariables(ref _vars); }