/// <summary> /// Constructor that accepts the type of executable (Object Moniker), a name of the executable and the immediate parent. /// In addition to assigning the MainPipe object, we also get a reference to the actual Package that contains this data flow task /// </summary> /// <param name="objectMoniker">The type of the Executable</param> /// <param name="displayName">The name of the executable</param> /// <param name="immediateContainer">The immediate parent of the executable</param> public ISDataFlowTask(string displayName, ISContainer immediateContainer, ISProject project = null, ISPackage package = null) : base("Microsoft.Pipeline", displayName, immediateContainer) { MainPipe = TaskHost.InnerObject as MainPipe; /*if (MainPipe == null) * { * Console.WriteLine("Main Pipe is null"); * } else * { * Console.WriteLine("MainPipe NOT null"); * }*/ if (package == null) { RootPackage = (ISContainer.GetActualPackage(immediateContainer).Container) as Microsoft.SqlServer.Dts.Runtime.Package; ParentPackage = (ISPackage)(RootPackage as Microsoft.SqlServer.Dts.Runtime.Package); } else { ParentPackage = package; RootPackage = package.Package; } if (project == null) { if (ParentPackage.Project == null) { ParentPackage.Project = project; } } else { ParentPackage.Project = project; } }
private ISContainer GetPackage(ISContainer container) { if (container.Parent_m == null) { return(container); } else { return(GetPackage(container.Parent)); } }
/// <summary> /// This method will return the actual Package object for the inputted ISContainer object. /// In some cases: /// this actual Package object will be the immediate parent and /// in some cases it can be an ancestor at any number of levels high (depending on how the containers are nested). /// </summary> /// <param name="container"></param> /// <returns></returns> internal static ISContainer GetActualPackage(ISContainer container) { if (container.Parent_m == null) { return(container); } else { return(GetActualPackage(container.Parent)); } }
public static ISContainer FindChildContainer(ISContainer parent, string childContainerName) { ISContainer childContainer = null; for (int c = 0; c < (parent.Container as IDTSSequence).Executables.Count; c++) { if (((parent.Container as IDTSSequence).Executables[c] as DtsContainer).Name == childContainerName) { childContainer = (ISContainer)((parent.Container as IDTSSequence).Executables[c] as DtsContainer); } } return(childContainer); }
/// <summary> /// Constructor that accepts the type of executable (Object Moniker), a name of the executable and the immediate parent. /// If immediateContainer is null, then it is assumed that we want to create the Package object itself. /// Otherwise: If an executable does not already exist in the parent container, it is created and added to the parent container /// </summary> /// <param name="objectMoniker">The type of the Executable</param> /// <param name="displayName">The name of the executable</param> /// <param name="immediateContainer">The immediate parent of the executable</param> internal ISExecutable(string objectMoniker, string displayName, ISContainer immediateContainer) { _objectMoniker = objectMoniker; _displayName = displayName; _immediateContainer = immediateContainer; if (_immediateContainer != null) { if (!(_immediateContainer.Container as IDTSSequence).Executables.Contains(displayName)) { Executable = ((IDTSSequence)_immediateContainer.Container).Executables.Add(objectMoniker); } else { ExecutableAlreadyExists = true; Executable = ((IDTSSequence)_immediateContainer.Container).Executables[displayName]; } } else { Executable = new Package(); } }
/// <summary> /// Constructor that accepts the type of executable (Object Moniker), a name of the executable and the immediate parent. /// </summary> /// <param name="displayName">The name of the executable</param> /// <param name="immediateContainer">The immediate parent of the executable</param> public ISForLoopContainer(string displayName, ISContainer immediateContainer) : base("STOCK:FORLOOP", displayName, immediateContainer) { ForLoop = EventsProvider as ForLoop; }
/// <summary> /// Constructor that accepts the type of executable (Object Moniker), a name of the executable and the immediate parent. /// </summary> /// <param name="displayName">The name of the executable</param> /// <param name="immediateContainer">The immediate parent of the executable</param> public ISScriptTask(string displayName, ISContainer immediateContainer) : base("STOCK:ScriptTask", displayName, immediateContainer) { ScriptTask = TaskHost.InnerObject as ScriptTask; }
/// <summary> /// Constructor that accepts the a name for the executable and the immediate parent. /// </summary> /// <param name="displayName">The name of the executable</param> /// <param name="immediateContainer">The immediate parent of the executable</param> public ISExecutePackageTask(string displayName, ISContainer immediateContainer) : base("Microsoft.ExecutePackageTask", displayName, immediateContainer) { ExecutePackageTask = TaskHost.InnerObject as ExecutePackageTask; }
/// <summary> /// Constructor that accepts the type of executable (Object Moniker), a name of the executable and the immediate parent. /// </summary> /// <param name="objectMoniker">The type of the Executable</param> /// <param name="displayName">The name of the executable</param> /// <param name="immediateContainer">The immediate parent of the executable</param> public ISEventsProvider(string objectMoniker, string displayName, ISContainer immediateContainer) : base(objectMoniker, displayName, immediateContainer) { EventsProvider = (EventsProvider)Container; }
/// <summary> /// Constructor that accepts the type of executable (Object Moniker), a name of the executable and the immediate parent. /// </summary> /// <param name="objectMoniker">The type of the Executable</param> /// <param name="displayName">The name of the executable</param> /// <param name="immediateContainer">The immediate parent of the executable</param> internal ISEventsProviderAsIDTSSequence(string objectMoniker, string displayName, ISContainer immediateContainer) : base(objectMoniker, displayName, immediateContainer) { EventsProviderAsIDTSSequence = (IDTSSequence)Container; }
/// <summary> /// Constructor that accepts a Name, whether Readonly or not, Namespace, Value, Expression and the parent to which the variables needs to be added. /// Also, there is a default parameter that accepts the data type /// </summary> /// <param name="variableName">Name of the variable</param> /// <param name="readOnly">whether Readonly or not</param> /// <param name="nameSpace">Namespace</param> /// <param name="val">Value</param> /// <param name="expression">Expression</param> /// <param name="parentContainer">Parent Container</param> /// <param name="userSpecifiedDataType"> A data type to be specified by the user. Use the VariableDataType enum for accepted values.</param> public ISVariable(string variableName, bool readOnly, string nameSpace, object val, string expression, ISContainer parentContainer, VariableDataType userSpecifiedDataType = VariableDataType.String) { bool variableExists = parentContainer.Variables_m.Contains(variableName); if (variableExists) { Variable = parentContainer.Variables_m[variableName]; } if (!(variableExists)) { switch (userSpecifiedDataType.ToString().ToLower()) { case "boolean": val = Convert.ToBoolean(val); break; case "byte": val = Convert.ToByte(val); break; case "char": val = Convert.ToChar(val); break; case "datetime": val = Convert.ToDateTime(val); break; case "decimal": val = Convert.ToDecimal(val); break; case "double": val = Convert.ToDouble(val); break; case "int16": val = Convert.ToInt16(val); break; case "int32": val = Convert.ToInt32(val); break; case "int64": val = Convert.ToInt64(val); break; case "sbyte": val = Convert.ToSByte(val); break; case "single": val = Convert.ToSingle(val); break; case "string": val = Convert.ToString(val); break; case "uint32": val = Convert.ToUInt32(val); break; case "uint64": val = Convert.ToUInt64(val); break; default: break; } Variable = parentContainer.Variables_m.Add(variableName, readOnly, nameSpace, val); Variable.Expression = expression; Variable.EvaluateAsExpression = String.IsNullOrEmpty(expression) ? false : true; } }
/// <summary> /// Constructor that accepts the type of executable (Object Moniker), a name of the executable and the immediate parent. /// </summary> /// <param name="objectMoniker">The type of the Executable</param> /// <param name="displayName">The name of the executable</param> /// <param name="immediateContainer">The immediate parent of the executable</param> internal ISTaskHost(string objectMoniker, string displayName, ISContainer immediateContainer) : base(objectMoniker, displayName, immediateContainer) { TaskHost = (TaskHost)EventsProvider; }
/// <summary> /// Constructor that accepts the type of executable (Object Moniker), a name of the executable and the immediate parent. /// </summary> /// <param name="displayName">The name of the executable</param> /// <param name="immediateContainer">The immediate parent of the executable</param> public ISExecuteSqlTask(string displayName, ISContainer immediateContainer) : base("STOCK:SQLTask", displayName, immediateContainer) { SQLTask = TaskHost.InnerObject as ExecuteSQLTask; }
/// <summary> /// Constructor that accepts the type of executable (Object Moniker), a name of the executable and the immediate parent. /// </summary> /// <param name="displayName">The name of the executable</param> /// <param name="immediateContainer">The immediate parent of the executable</param> public ISSequence(string displayName, ISContainer immediateContainer) : base("STOCK:Sequence", displayName, immediateContainer) { Sequence = EventsProvider as Sequence; }
/// <summary> /// Constructor that accepts the type of executable (Object Moniker), a name of the executable and the immediate parent. /// </summary> /// <param name="objectMoniker">The type of the Executable</param> /// <param name="displayName">The name of the executable</param> /// <param name="immediateContainer">The immediate parent of the executable</param> internal ISContainer(string objectMoniker, string displayName, ISContainer immediateContainer) : base(objectMoniker, displayName, immediateContainer) { Container = (DtsContainer)Executable; Name = displayName; }