public override bool OnError(DtsObject source, int errorCode, string subComponent, string description, string helpFile, int helpContext, string idofInterfaceWithError) { // Output Error Message Console.WriteLine("Error in {0}/{1} : {2}", source, subComponent, description); return false; }
public override void OnWarning(DtsObject source, int warningCode, string subComponent, string description, string helpFile, int helpContext, string idofInterfaceWithError) { var subComponentText = string.IsNullOrEmpty(subComponent) ? "" : $"/{subComponent}"; onScreenLogger.Log($"SSIS Event Listener > Warning - {source}{subComponentText}: Description - {description}", LogType.Info); }
void IDTSEvents.OnWarning(DtsObject source, int warningCode, string subComponent, string description, string helpFile, int helpContext, string idofInterfaceWithError) { LogDtsEvent( LogEventLevel.Warning, "source:{@source} warningCode:{warningCode} subComponent={subComponent} description={description} ", new object[] { source, warningCode, subComponent, description }); }
public override bool OnError(DtsObject source, int errorCode, string subComponent, string description, string helpFile, int helpContext, string idofInterfaceWithError) { // Add application-specific diagnostics here. Console.WriteLine("Error in {0}/{1} : {2}", source, subComponent, description); return(false); }
public override bool OnError(DtsObject source, int errorCode, string subComponent, string description, string helpFile, int helpContext, string idofInterfaceWithError) { // Add application-specific diagnostics here. MessageBox.Show("Error in " + "/t" + source + "/t" + subComponent + "/t" + description); return(false); }
public override void OnInformation(DtsObject source, int informationCode, string subComponent, string description, string helpFile, int helpContext, string idofInterfaceWithError, ref bool fireAgain) { var subComponentText = string.IsNullOrEmpty(subComponent) ? "" : $"/{subComponent}"; onScreenLogger.Log($"SSIS Event Listener > Information - {source}{subComponentText} : {description}", LogType.Info); fireAgain = true; }
public override bool OnError(DtsObject source, int errorCode, string subComponent, string description, string helpFile, int helpContext, string idofInterfaceWithError) { var subComponentText = string.IsNullOrEmpty(subComponent) ? "" : $"/{subComponent}"; onScreenLogger.Log($"SSIS Event Listener > Error - {source}{subComponentText} : {description}", LogType.Error); return(false); }
public override bool OnError(DtsObject source, int errorCode, string subComponent, string description, string helpFile, int helpContext, string idofInterfaceWithError) { // Add application-specific diagnostics here. mailBody += "Error in " + source + " / " + subComponent + " : " + description; Console.WriteLine("Error in " + source + " / " + subComponent + " : " + description); return(false); }
public override bool OnError(DtsObject source, int errorCode, string subComponent, string description, string helpFile, int helpContext, string idofInterfaceWithError) { // Todo //Logger log = new Logger("C:\\LOG\\log2.txt"); //log.Log("Ex in Package",String.Format("Error in {0}/{1} : {2}", source, subComponent, description)); return(base.OnError(source, errorCode, subComponent, description, helpFile, helpContext, idofInterfaceWithError)); }
public override bool OnError(DtsObject source, int errorCode, string subComponent, string description, string helpFile, int helpContext, string idofInterfaceWithError) { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine($"Source: {source} \n SubComponent: {subComponent} \n Description {description}"); Console.ResetColor(); return(false); }
public bool OnError(DtsObject source, int errorCode, string subComponent, string description, string helpFile, int helpContext, string idofInterfaceWithError) { _builder.AppendLine(String.Format( "[{3}] ERROR: [{0}] [{1}] [{2}]", errorCode, subComponent, description, DateTime.Now.ToLongTimeString() )); return(false); }
// check if this does not disable packages OnError event -> sending email!!! public override bool OnError(DtsObject source, int errorCode, string subComponent, string description, string helpFile, int helpContext, string idofInterfaceWithError) { // log error to file - ensure setting log file path first from calling application! Logger.Add(source + " " + errorCode + " " + subComponent + " " + description + " " + helpFile + " " + helpContext + " " + idofInterfaceWithError); // call base class on error return base.OnError(source, errorCode, subComponent, description, helpFile, helpContext, idofInterfaceWithError); }
public override bool OnError(DtsObject source, int errorCode, string subComponent, string description, string helpFile, int helpContext, string idofInterfaceWithError) { if (string.IsNullOrEmpty(subComponent)) Message = string.Format("{0}\r\n[{2}] - {1}", Message, description, errorCode); else Message = string.Format("{0}\r\n[{3}] in {1} - {2}", Message, subComponent, description, errorCode); return base.OnError(source, errorCode, subComponent, description, helpFile, helpContext, idofInterfaceWithError); }
public override bool OnError(DtsObject source, int errorCode, string subComponent, string description, string helpFile, int helpContext, string idofInterfaceWithError) { ErrorMsg msge = new ErrorMsg { Component = subComponent, Description = description }; _msg.Add(msge); return(false); }
public bool OnError( DtsObject source, int errorCode, string subComponent, string description, string helpFile, int helpContext, string idofInterfaceWithError) { throw new InvalidOperationException($"Error:{subComponent}:{description}"); }
public void OnWarning( DtsObject source, int warningCode, string subComponent, string description, string helpFile, int helpContext, string idofInterfaceWithError) { Debug.WriteLine($"{nameof(OnWarning)} - {subComponent} : {description}"); }
public void OnInformation( DtsObject source, int informationCode, string subComponent, string description, string helpFile, int helpContext, string idofInterfaceWithError, ref bool fireAgain) { Debug.WriteLine($"{nameof(OnInformation)} - {subComponent} : {description}"); }
public override bool OnError(DtsObject source, int errorCode, string subComponent, string description, string helpFile, int helpContext, string idofInterfaceWithError) { _packageErrors.Add( string.Format( CultureInfo.CurrentCulture, "Source: {0} | Error Code: {1} | Sub Component: {2} | Description: {3}", source, errorCode, subComponent, description)); return(true); }
public override bool OnError(DtsObject source, int errorCode, string subComponent, string description, string helpFile, int helpContext, string idofInterfaceWithError) { if (string.IsNullOrEmpty(subComponent)) { Message = string.Format("{0}\r\n[{2}] - {1}", Message, description, errorCode); } else { Message = string.Format("{0}\r\n[{3}] in {1} - {2}", Message, subComponent, description, errorCode); } return(base.OnError(source, errorCode, subComponent, description, helpFile, helpContext, idofInterfaceWithError)); }
private object SetPropertyValue(DtsObject dtsObject, string propertyPath, object value) { propertyPath = propertyPath.Replace("\\", "."); object returnValue = null; string firstPart = propertyPath; string restOfString = string.Empty; if (propertyPath.Contains(".")) { //Can have periods in object names (like connection manager names) //Need to verify that period is not between an index marker int delimiterIndex = propertyPath.IndexOf("."); //while (delimiterIndex > propertyPath.IndexOf("[") && // delimiterIndex < propertyPath.IndexOf("]")) //{ // delimiterIndex = propertyPath.IndexOf(".", delimiterIndex + 1 ); //} if (delimiterIndex > propertyPath.IndexOf("[") && delimiterIndex < propertyPath.IndexOf("]")) { delimiterIndex = propertyPath.IndexOf(".", propertyPath.IndexOf("]")); } if (delimiterIndex > -1) { firstPart = propertyPath.Substring(0, delimiterIndex); restOfString = propertyPath.Substring(delimiterIndex + 1, (propertyPath.Length - (delimiterIndex + 1))); if (firstPart.Length == 0) { return SetPropertyValue(dtsObject, restOfString, value); } } } if (firstPart.ToUpper().StartsWith("PACKAGE")) { if (!(dtsObject is Package)) { throw new ArgumentException("The initial object must be of type Package.", "dtsObject"); } return SetPropertyValue(dtsObject, restOfString, value); } // \Package.Variables[User::TestVar].Properties[Value] if (firstPart.ToUpper().StartsWith("VARIABLES")) { if (!(dtsObject is DtsContainer)) { throw new ArgumentException("Object must be of type DtsContainer to reference variables.", "dtsObject"); } Variables vars = null; string varName = GetSubStringBetween(firstPart, "[", "]"); DtsContainer cont = (DtsContainer)dtsObject; cont.VariableDispenser.LockOneForRead(varName, ref vars); returnValue = SetPropertyValue(vars[varName], restOfString, value); vars.Unlock(); return returnValue; } // \Package.Properties[CreationDate] if (firstPart.ToUpper().StartsWith("PROPERTIES")) { if (!(dtsObject is IDTSPropertiesProvider)) { throw new ArgumentException("Object must be of type IDTSPropertiesProvider to reference properties.", "dtsObject"); } IDTSPropertiesProvider propProv = (IDTSPropertiesProvider)dtsObject; string propIndex = GetSubStringBetween(firstPart, "[", "]"); DtsProperty prop = propProv.Properties[propIndex]; if (dtsObject is Variable) { Variable var = (Variable)dtsObject; prop.SetValue(dtsObject, Convert.ChangeType(value, var.DataType)); } else { prop.SetValue(dtsObject, Convert.ChangeType(value, propProv.Properties[propIndex].Type)); } //Flag value as changing changesvc.OnComponentChanging(prop, null); changesvc.OnComponentChanged(prop, null, null, null); //marks the package designer as dirty return prop.GetValue(dtsObject); } // \Package.Connections[localhost.AdventureWorksDW2008].Properties[Description] if (firstPart.ToUpper().StartsWith("CONNECTIONS")) { if (!(dtsObject is Package)) { throw new ArgumentException("Object must be of type Package to reference Connections.", "dtsObject"); } string connIndex = GetSubStringBetween(firstPart, "[", "]"); Package pkg = (Package)dtsObject; return SetPropertyValue(pkg.Connections[connIndex], restOfString, value); } // \Package.EventHandlers[OnError].Properties[Description] if (firstPart.ToUpper().StartsWith("EVENTHANDLERS")) { if (!(dtsObject is EventsProvider)) { throw new ArgumentException("Object must be of type EventsProvider to reference events.", "dtsObject"); } EventsProvider eventProvider = (EventsProvider)dtsObject; string eventIndex = GetSubStringBetween(firstPart, "[", "]"); return SetPropertyValue(eventProvider.EventHandlers[eventIndex], restOfString, value); } //First Part of string is not one of the hard-coded values - it's either a task or container if (!(dtsObject is IDTSSequence)) { throw new ArgumentException("Object must be of type IDTSSequence to reference other tasks or containers.", "dtsObject"); } IDTSSequence seq = (IDTSSequence)dtsObject; if (seq.Executables.Contains(firstPart)) { return SetPropertyValue(seq.Executables[firstPart], restOfString, value); } // \Package\Sequence Container\Script Task.Properties[Description] // \Package\Sequence Container.Properties[Description] // \Package\Execute SQL Task.Properties[Description] //\Package.EventHandlers[OnError].Variables[System::Cancel].Properties[Value] // \Package.EventHandlers[OnError]\Script Task.Properties[Description] if (restOfString.Length > 0) { returnValue = SetPropertyValue(dtsObject, restOfString, value); } return returnValue; }
public bool OnError(DtsObject source, int errorCode, string subComponent, string description, string helpFile, int helpContext, string idofInterfaceWithError) { _builder.AppendLine(String.Format( "[{3}] ERROR: [{0}] [{1}] [{2}]", errorCode, subComponent, description, DateTime.Now.ToLongTimeString() )); return false; }
public void OnInformation(DtsObject source, int informationCode, string subComponent, string description, string helpFile, int helpContext, string idofInterfaceWithError, ref bool fireAgain) { _builder.AppendLine(String.Format( "[{3}] INFO: [{0}] [{1}] [{2}]", informationCode, subComponent, description, DateTime.Now.ToLongTimeString() )); }
internal void BuildToDos(Window GotFocus, DtsObject oIncrementalObject, int? iIncrementalTransformID) { try { DateTime dtToDoBuildingStartTime = DateTime.Now; DateTime dtSynchronousHighlightingCutoff = DateTime.Now.AddSeconds(MAX_SYNCHRONOUS_HIGHLIGHTING_TIME_SECONDS); if (!this.Enabled) return; if (ExpressionListPlugin.shouldSkipExpressionHighlighting) return; DtsContainer oIncrementalContainer = oIncrementalObject as DtsContainer; ConnectionManager oIncrementalConnectionManager = oIncrementalObject as ConnectionManager; bool bIncremental = (oIncrementalContainer != null); bool bRescan = false; if (oIncrementalContainer is Package) { bIncremental = false; bRescan = true; } if (GotFocus == null) return; if (GotFocus.DTE.Mode == vsIDEMode.vsIDEModeDebug) return; IDesignerHost designer = GotFocus.Object as IDesignerHost; if (designer == null) return; ProjectItem pi = GotFocus.ProjectItem; if (!(pi.Name.ToLower().EndsWith(".dtsx"))) return; EditorWindow win = (EditorWindow)designer.GetService(typeof(Microsoft.DataWarehouse.ComponentModel.IComponentNavigator)); Package package = (Package)win.PropertiesLinkComponent; //check whether we should abort because highlighting has been disabled for this window if (disableHighlighting.ContainsKey(win) && disableHighlighting[win]) return; /////////////////////////////////////////////////////////////////////////////////////////////////////// //NEW REQUEUE CODE DESIGNED TO POSTPONE WORK DONE DURING A PASTE OPERATION UNTIL AFTER IS HAS COMPLETED bool bRequeue = false; try { #if DENALI IClipboardService clipboardService = (IClipboardService)package.Site.GetService(typeof(IClipboardService)); if (clipboardService.IsPasteActive) bRequeue = true; #else for (int iViewIndex = 0; iViewIndex < 3; iViewIndex++) { if (bRequeue) break; EditorWindow.EditorView view = win.Views[iViewIndex]; Control viewControl = (Control)view.GetType().InvokeMember("ViewControl", getflags, null, view, null); if (viewControl == null) continue; if (iViewIndex == 0) //Control Flow { //((Microsoft.DataTransformationServices.Design.DtsBasePackageDesigner)(((Microsoft.DataTransformationServices.Design.DtsPackageView)(win)).packageDesigner)).ClipboardService.IsPasteActive //(((Microsoft.DataTransformationServices.Design.SurfaceCommandHelper)(((Microsoft.DataTransformationServices.Design.ControlFlowControl)(viewControl)).m_surfaceCommands))).ClipboardService.IsPasteActive //((Microsoft.DataTransformationServices.Design.DtsBasePackageDesigner)(((Microsoft.DataTransformationServices.Design.ControlFlowControl)(viewControl)).PackageDesigner)).ClipboardService //Microsoft.DataTransformationServices.Design.Control DdsDiagramHostControl diagram = viewControl.Controls["panel1"].Controls["ddsDiagramHostControl1"] as DdsDiagramHostControl; if (diagram == null) continue; if (diagram.ComponentDiagram == null) continue; object oDtrControlFlowDiagram = diagram.ComponentDiagram; Microsoft.DataWarehouse.Design.ClipboardCommandHelper clipoardCommandHelper = (Microsoft.DataWarehouse.Design.ClipboardCommandHelper)oDtrControlFlowDiagram.GetType().InvokeMember("clipboardCommandHandler", System.Reflection.BindingFlags.ExactBinding | System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.GetField, null, oDtrControlFlowDiagram, null); bool bPasteInProgress = (bool)clipoardCommandHelper.GetType().InvokeMember("PasteInProgress", System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.GetProperty | System.Reflection.BindingFlags.ExactBinding | System.Reflection.BindingFlags.Instance, null, clipoardCommandHelper, null); if (bPasteInProgress) { //limiting to this allowed an ex SQL with event handler to be pasted: oIncrementalObject is Microsoft.SqlServer.Dts.Runtime.DtsEventHandler System.Diagnostics.Debug.WriteLine("paste in progress on control flow"); bRequeue = true; break; } } else if (iViewIndex == 2) //Event Handlers { foreach (Control c in viewControl.Controls["panel1"].Controls["panelDiagramHost"].Controls) { DdsDiagramHostControl diagram = c as DdsDiagramHostControl; if (diagram == null) continue; if (diagram.ComponentDiagram == null) continue; object oDtrControlFlowDiagram = diagram.ComponentDiagram; Microsoft.DataWarehouse.Design.ClipboardCommandHelper clipoardCommandHelper = (Microsoft.DataWarehouse.Design.ClipboardCommandHelper)oDtrControlFlowDiagram.GetType().InvokeMember("clipboardCommandHandler", System.Reflection.BindingFlags.ExactBinding | System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.GetField, null, oDtrControlFlowDiagram, null); bool bPasteInProgress = (bool)clipoardCommandHelper.GetType().InvokeMember("PasteInProgress", System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.GetProperty | System.Reflection.BindingFlags.ExactBinding | System.Reflection.BindingFlags.Instance, null, clipoardCommandHelper, null); if (bPasteInProgress) { System.Diagnostics.Debug.WriteLine("paste in progress on event handlers"); bRequeue = true; break; } } } else if (iViewIndex == 1) //Data Flow { foreach (Control c in viewControl.Controls["panel2"].Controls["pipelineDetailsControl"].Controls) { DdsDiagramHostControl diagram = c as DdsDiagramHostControl; if (diagram == null) continue; if (diagram.ComponentDiagram == null) continue; ComponentDiagram oDtrControlFlowDiagram = diagram.ComponentDiagram; //#if DENALI //IClipboardService clipService = diagram.Site.GetService(typeof(IClipboardService)) as IClipboardService; //#else Microsoft.DataWarehouse.Design.ClipboardCommandHelper clipboardCommandHelper = (Microsoft.DataWarehouse.Design.ClipboardCommandHelper)typeof(ComponentDiagram).InvokeMember("clipboardCommands", System.Reflection.BindingFlags.ExactBinding | System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.GetField, null, oDtrControlFlowDiagram, null); Microsoft.SqlServer.Dts.Design.IDtsClipboardService clipService = (Microsoft.SqlServer.Dts.Design.IDtsClipboardService)clipboardCommandHelper.GetType().BaseType.InvokeMember("dtsClipboardService", System.Reflection.BindingFlags.ExactBinding | System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.GetField, null, clipboardCommandHelper, null); //#endif bool bPasteInProgress = clipService.IsPasteActive; if (bPasteInProgress) { System.Diagnostics.Debug.WriteLine("paste in progress on data flow"); bRequeue = true; break; } } } } #endif } catch (Exception ex) { System.Diagnostics.Debug.WriteLine("Problem checking if there is a paste underway: " + ex.Message + "\r\n" + ex.StackTrace); } if (bRequeue) { RequeueToDo todo = new RequeueToDo(); lock (highlightingToDos) { highlightingToDos.Add(todo, todo); todo.editorWin = win; todo.GotFocus = GotFocus; todo.oIncrementalObject = oIncrementalObject; todo.iIncrementalTransformID = iIncrementalTransformID; todo.package = package; todo.plugin = this; todo.BackgroundOnly = false; //run all the requeues first as it will avoid redoing lots of work todo.Rescan = false; } System.Diagnostics.Debug.WriteLine("requeued as todo"); StartToDosThread(dtSynchronousHighlightingCutoff); return; } //END OF NEW REQUEUE CODE /////////////////////////////////////////////////////////////////////////////////////////////////////// #if !DENALI try { if (!mostRecentDDSRefresh.ContainsKey(win)) mostRecentDDSRefresh.Add(win, DateTime.MinValue); //only call this code if the last time you called it is less than the last time one of the component added events fired for this package if (mostRecentDDSRefresh[win] < mostRecentComponentEvent) { mostRecentDDSRefresh[win] = DateTime.Now; ExpressionListPlugin.shouldSkipExpressionHighlighting = true; //don't come into this design time properties code until the prior one finished //refresh DDS objects as all their properties aren't updated until you save the DTSX file //this code is to workaround a problem such that a newly copied/pasted TaskHost isn't linked in via the DDS objects correctly until this refresh System.Diagnostics.Debug.WriteLine("refreshing DDS objects"); System.Collections.Hashtable designTimeProperties = new System.Collections.Hashtable(); System.Reflection.BindingFlags publicstaticflags = System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.InvokeMethod | System.Reflection.BindingFlags.DeclaredOnly | System.Reflection.BindingFlags.Static; TYPE_DTS_SERIALIZATION.InvokeMember("CollectDesignTimeProperties", publicstaticflags, null, null, new object[] { package, designTimeProperties }); TYPE_DTS_SERIALIZATION.InvokeMember("SaveDesignTimePropertiesToPackage", publicstaticflags, null, null, new object[] { package, designTimeProperties }); } } finally { ExpressionListPlugin.shouldSkipExpressionHighlighting = false; } #endif if (win.Tag == null) { win.ActiveViewChanged += new EventHandler(win_ActiveViewChanged); IComponentChangeService configurationsChangeService = (IComponentChangeService)designer; configurationsChangeService.ComponentChanged += new ComponentChangedEventHandler(configurationsChangeService_ComponentChanged); configurationsChangeService.ComponentAdded += new ComponentEventHandler(configurationsChangeService_ComponentAdded); win.Tag = true; bRescan = true; } for (int iViewIndex = 0; iViewIndex <= (int)SSISHelpers.SsisDesignerTabIndex.EventHandlers; iViewIndex++) { EditorWindow.EditorView view = win.Views[iViewIndex]; Control viewControl = (Control)view.GetType().InvokeMember("ViewControl", getflags, null, view, null); if (viewControl == null) continue; if (iViewIndex == (int)SSISHelpers.SsisDesignerTabIndex.ControlFlow) { #if DENALI //it's now a Microsoft.DataTransformationServices.Design.Controls.DtsConnectionsListView object which doesn't inherit from ListView and which is internal Control lvwConnMgrs = (Control)viewControl.Controls["controlFlowTrayTabControl"].Controls["controlFlowConnectionsTabPage"].Controls["controlFlowConnectionsListView"]; if (lvwConnMgrs != null) { BuildConnectionManagerToDos(package, lvwConnMgrs, bIncremental, bRescan, oIncrementalConnectionManager); } #else ListView lvwConnMgrs = (ListView)viewControl.Controls["controlFlowTrayTabControl"].Controls["controlFlowConnectionsTabPage"].Controls["controlFlowConnectionsListView"]; BuildConnectionManagerToDos(package, lvwConnMgrs, bIncremental, bRescan, oIncrementalConnectionManager); #endif #if DENALI Microsoft.SqlServer.IntegrationServices.Designer.Model.ControlFlowGraphModelElement ctlFlowModel = (Microsoft.SqlServer.IntegrationServices.Designer.Model.ControlFlowGraphModelElement)viewControl.GetType().InvokeMember("GraphModel", System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.GetProperty, null, viewControl, null); foreach (Microsoft.SqlServer.Graph.Model.ModelElement task in ctlFlowModel) { Executable executable = null; Microsoft.SqlServer.Graph.Extended.IModelElementEx taskModelEl = task as Microsoft.SqlServer.Graph.Extended.IModelElementEx; if (taskModelEl != null) { executable = taskModelEl.LogicalObject as Executable; bool bRescanThisTask = bRescan; if (oIncrementalContainer == executable) { bRescanThisTask = true; } if (executable != null) { TaskHighlightingToDo todo; lock (highlightingToDos) { if (highlightingToDos.ContainsKey(executable)) todo = (TaskHighlightingToDo)highlightingToDos[executable]; else highlightingToDos.Add(executable, todo = new TaskHighlightingToDo()); todo.package = package; todo.executable = executable; todo.controlFlowDesigner = designer; todo.controlFlowTaskModelElement = task; todo.BackgroundOnly = !(!todo.BackgroundOnly || (view.Selected && viewControl.Visible)); todo.Rescan = bRescanThisTask; } } } } #else DdsDiagramHostControl diagram = viewControl.Controls["panel1"].Controls["ddsDiagramHostControl1"] as DdsDiagramHostControl; if (diagram == null) continue; IDTSSequence container = (IDTSSequence)diagram.ComponentDiagram.RootComponent; foreach (MSDDS.IDdsDiagramObject o in diagram.DDS.Objects) { if (o.Type != DdsLayoutObjectType.dlotShape) continue; MSDDS.IDdsExtendedProperty prop = o.IDdsExtendedProperties.Item("LogicalObject"); if (prop == null) continue; string sObjectGuid = prop.Value.ToString(); Executable executable = null; bool bRescanThisTask = bRescan; if (oIncrementalContainer != null && oIncrementalContainer.ID == sObjectGuid) { executable = oIncrementalContainer; bRescanThisTask = true; } else { executable = FindExecutable(container, sObjectGuid); } if (executable != null) { TaskHighlightingToDo todo; lock (highlightingToDos) { if (highlightingToDos.ContainsKey(executable)) todo = (TaskHighlightingToDo)highlightingToDos[executable]; else highlightingToDos.Add(executable, todo = new TaskHighlightingToDo()); todo.package = package; todo.executable = executable; todo.controlFlowDesigner = designer; todo.controlFlowDiagram = diagram; todo.controlFlowDiagramTask = o; todo.BackgroundOnly = !(!todo.BackgroundOnly || (view.Selected && diagram.Visible)); todo.Rescan = bRescanThisTask; } } } #endif } else if (iViewIndex == (int)SSISHelpers.SsisDesignerTabIndex.EventHandlers) { Microsoft.DataTransformationServices.Design.Controls.EventHandlersComboBox eventHandlersCombo = ((Microsoft.DataTransformationServices.Design.Controls.EventHandlersComboBox)(viewControl.Controls["panel1"].Controls["panel2"].Controls["comboBoxEventHandler"])); if (eventHandlersCombo.Tag == null) { eventHandlersCombo.SelectedIndexChanged += new EventHandler(comboBox_SelectedIndexChanged); eventHandlersCombo.Tag = true; //don't need to monitor the Base Control (leftmost) combo box because changing it will trigger a change to the event handler combo: ((Microsoft.DataWarehouse.Controls.BaseControlComboBox)(viewControl.Controls["panel1"].Controls["panel2"].Controls["Custom ComboBox"])) } #if DENALI //it's now a Microsoft.DataTransformationServices.Design.Controls.DtsConnectionsListView object which doesn't inherit from ListView and which is internal Control lvwConnMgrs = (Control)viewControl.Controls["controlFlowTrayTabControl"].Controls["controlFlowConnectionsTabPage"].Controls["controlFlowConnectionsListView"]; if (lvwConnMgrs != null) { BuildConnectionManagerToDos(package, lvwConnMgrs, bIncremental, bRescan, oIncrementalConnectionManager); } #else ListView lvwConnMgrs = (ListView)viewControl.Controls["controlFlowTrayTabControl"].Controls["controlFlowConnectionsTabPage"].Controls["controlFlowConnectionsListView"]; BuildConnectionManagerToDos(package, lvwConnMgrs, bIncremental, bRescan, oIncrementalConnectionManager); #endif #if DENALI foreach (Control c in viewControl.Controls["panel1"].Controls["panelDiagramHost"].Controls) { if (!(c is Microsoft.DataTransformationServices.Design.EventHandlerElementHost)) continue; Microsoft.SqlServer.IntegrationServices.Designer.Model.ControlFlowGraphModelElement ctlFlowModel = (Microsoft.SqlServer.IntegrationServices.Designer.Model.ControlFlowGraphModelElement)c.GetType().InvokeMember("GraphModel", System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.GetProperty, null, c, null); foreach (Microsoft.SqlServer.Graph.Model.ModelElement task in ctlFlowModel) { Executable executable = null; Microsoft.SqlServer.Graph.Extended.IModelElementEx taskModelEl = task as Microsoft.SqlServer.Graph.Extended.IModelElementEx; if (taskModelEl != null) { executable = taskModelEl.LogicalObject as Executable; bool bRescanThisTask = bRescan; if (oIncrementalContainer == executable) { bRescanThisTask = true; } if (executable != null) { TaskHighlightingToDo todo; lock (highlightingToDos) { if (highlightingToDos.ContainsKey(executable)) todo = (TaskHighlightingToDo)highlightingToDos[executable]; else highlightingToDos.Add(executable, todo = new TaskHighlightingToDo()); todo.package = package; todo.executable = executable; todo.controlFlowDesigner = designer; todo.controlFlowTaskModelElement = task; todo.BackgroundOnly = !(!todo.BackgroundOnly || (view.Selected && c.Visible)); todo.Rescan = bRescanThisTask; } } } } } #else foreach (Control c in viewControl.Controls["panel1"].Controls["panelDiagramHost"].Controls) { DdsDiagramHostControl diagram = c as DdsDiagramHostControl; if (diagram == null) continue; IDTSSequence container = (IDTSSequence)diagram.ComponentDiagram.RootComponent; foreach (MSDDS.IDdsDiagramObject o in diagram.DDS.Objects) { if (o.Type != DdsLayoutObjectType.dlotShape) continue; MSDDS.IDdsExtendedProperty prop = o.IDdsExtendedProperties.Item("LogicalObject"); if (prop == null) continue; string sObjectGuid = prop.Value.ToString(); Executable executable = null; bool bRescanThisTask = bRescan; if (oIncrementalContainer != null && oIncrementalContainer.ID == sObjectGuid) { executable = oIncrementalContainer; bRescanThisTask = true; } else { executable = FindExecutable(container, sObjectGuid); } if (executable != null) { TaskHighlightingToDo todo; lock (highlightingToDos) { if (highlightingToDos.ContainsKey(executable)) todo = (TaskHighlightingToDo)highlightingToDos[executable]; else highlightingToDos.Add(executable, todo = new TaskHighlightingToDo()); todo.package = package; todo.executable = executable; todo.controlFlowDesigner = designer; todo.controlFlowDiagram = diagram; todo.controlFlowDiagramTask = o; todo.BackgroundOnly = !(!todo.BackgroundOnly || (view.Selected && diagram.Visible)); todo.Rescan = bRescanThisTask; } } } } #endif } else if (iViewIndex == (int)SSISHelpers.SsisDesignerTabIndex.DataFlow) { #if DENALI //it's now a Microsoft.DataTransformationServices.Design.Controls.DtsConnectionsListView object which doesn't inherit from ListView and which is internal Control lvwConnMgrs = (Control)viewControl.Controls["dataFlowsTrayTabControl"].Controls["dataFlowConnectionsTabPage"].Controls["dataFlowConnectionsListView"]; if (lvwConnMgrs != null) { BuildConnectionManagerToDos(package, lvwConnMgrs, bIncremental, bRescan, oIncrementalConnectionManager); } #else ListView lvwConnMgrs = (ListView)viewControl.Controls["dataFlowsTrayTabControl"].Controls["dataFlowConnectionsTabPage"].Controls["dataFlowConnectionsListView"]; BuildConnectionManagerToDos(package, lvwConnMgrs, bIncremental, bRescan, oIncrementalConnectionManager); #endif #if DENALI Microsoft.DataTransformationServices.Design.Controls.PipelineComboBox pipelineComboBox = (Microsoft.DataTransformationServices.Design.Controls.PipelineComboBox)(viewControl.Controls["panel1"].Controls["tableLayoutPanel"].Controls["pipelineComboBox"]); if (pipelineComboBox.Tag == null) { pipelineComboBox.SelectedIndexChanged += new EventHandler(comboBox_SelectedIndexChanged); pipelineComboBox.Tag = true; } foreach (Control c in viewControl.Controls["panel2"].Controls["pipelineDetailsControl"].Controls) { if (c.GetType().FullName != "Microsoft.DataTransformationServices.Design.PipelineTaskView") continue; object pipelineDesigner = c.GetType().InvokeMember("PipelineTaskDesigner", System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.GetProperty, null, c, null); if (pipelineDesigner == null) continue; Microsoft.SqlServer.IntegrationServices.Designer.Model.DataFlowGraphModelElement dataFlowModel = (Microsoft.SqlServer.IntegrationServices.Designer.Model.DataFlowGraphModelElement)pipelineDesigner.GetType().InvokeMember("DataFlowGraphModel", System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.GetProperty, null, pipelineDesigner, null); List<string> transforms = new List<string>(); Executable executable = null; foreach (Microsoft.SqlServer.Graph.Model.ModelElement transform in dataFlowModel) { Microsoft.SqlServer.Graph.Extended.IModelElementEx transformModelEl = transform as Microsoft.SqlServer.Graph.Extended.IModelElementEx; if (transformModelEl != null) { Microsoft.DataTransformationServices.PipelineComponentMetadata metadata = transformModelEl.LogicalObject as Microsoft.DataTransformationServices.PipelineComponentMetadata; if (metadata == null) continue; executable = metadata.PipelineTask as Executable; int id = metadata.ID; string sName = metadata.Name; string sObjectGuid = pi.Name + "/" + metadata.PipelineTask.ID + "/components/" + id; //this is the todo key... (trying to use the IDTSComponentMetaDataXX as the key caused problems with COM object references and threading) transforms.Add(sObjectGuid); TransformHighlightingToDo transformTodo; lock (highlightingToDos) { if (highlightingToDos.ContainsKey(sObjectGuid)) transformTodo = (TransformHighlightingToDo)highlightingToDos[sObjectGuid]; else highlightingToDos.Add(sObjectGuid, transformTodo = new TransformHighlightingToDo()); transformTodo.package = package; transformTodo.dataFlowTransformModelElement = transform; transformTodo.taskHost = dataFlowModel.PipelineTask; transformTodo.transformName = sName; transformTodo.transformUniqueID = sObjectGuid; transformTodo.BackgroundOnly = !(!transformTodo.BackgroundOnly || (view.Selected && c.Visible)); } } } TaskHighlightingToDo todo; lock (highlightingToDos) { if (highlightingToDos.ContainsKey(executable)) todo = (TaskHighlightingToDo)highlightingToDos[executable]; else highlightingToDos.Add(executable, todo = new TaskHighlightingToDo()); todo.package = package; todo.executable = executable; todo.BackgroundOnly = !(!todo.BackgroundOnly || (view.Selected && c.Visible)); if (todo.transforms == null) { todo.transforms = transforms; } else { lock (todo.transforms) { todo.transforms = transforms; } } } } #else Microsoft.DataTransformationServices.Design.Controls.PipelineComboBox pipelineComboBox = (Microsoft.DataTransformationServices.Design.Controls.PipelineComboBox)(viewControl.Controls["panel1"].Controls["pipelineComboBox"]); if (pipelineComboBox.Tag == null) { pipelineComboBox.SelectedIndexChanged += new EventHandler(comboBox_SelectedIndexChanged); pipelineComboBox.Tag = true; } foreach (Control c in viewControl.Controls["panel2"].Controls["pipelineDetailsControl"].Controls) { DdsDiagramHostControl diagram = c as DdsDiagramHostControl; if (diagram == null) continue; TaskHost taskHost = (TaskHost)diagram.ComponentDiagram.RootComponent; Executable executable = (Executable)taskHost; MainPipe pipe = (MainPipe)taskHost.InnerObject; IDTSSequence container = (IDTSSequence)taskHost.Parent; if (bIncremental && !bRescan && oIncrementalContainer != taskHost) continue; List<string> transforms = new List<string>(); foreach (MSDDS.IDdsDiagramObject o in diagram.DDS.Objects) { if (o.Type == DdsLayoutObjectType.dlotShape) { MSDDS.IDdsExtendedProperty prop = o.IDdsExtendedProperties.Item("LogicalObject"); if (prop == null) continue; string sObjectGuid = prop.Value.ToString(); int id = int.Parse(sObjectGuid.Substring(sObjectGuid.LastIndexOf("/") + 1)); sObjectGuid = pi.Name + "/" + sObjectGuid; //this is the todo key... (trying to use the IDTSComponentMetaDataXX as the key caused problems with COM object references and threading) IDTSComponentMetaDataXX transform = pipe.ComponentMetaDataCollection.GetObjectByID(id); transforms.Add(sObjectGuid); TransformHighlightingToDo transformTodo; lock (highlightingToDos) { if (highlightingToDos.ContainsKey(sObjectGuid)) transformTodo = (TransformHighlightingToDo)highlightingToDos[sObjectGuid]; else highlightingToDos.Add(sObjectGuid, transformTodo = new TransformHighlightingToDo()); transformTodo.package = package; transformTodo.dataFlowDesigner = designer; transformTodo.dataFlowDiagram = diagram; transformTodo.dataFlowDiagramTask = o; transformTodo.taskHost = taskHost; transformTodo.transformName = transform.Name; transformTodo.transformUniqueID = sObjectGuid; transformTodo.BackgroundOnly = !(!transformTodo.BackgroundOnly || (view.Selected && diagram.Visible)); } System.Runtime.InteropServices.Marshal.FinalReleaseComObject(transform); } } TaskHighlightingToDo todo; lock (highlightingToDos) { if (highlightingToDos.ContainsKey(executable)) todo = (TaskHighlightingToDo)highlightingToDos[executable]; else highlightingToDos.Add(executable, todo = new TaskHighlightingToDo()); todo.package = package; todo.executable = executable; todo.BackgroundOnly = !(!todo.BackgroundOnly || (view.Selected && diagram.Visible)); if (todo.transforms == null) { todo.transforms = transforms; } else { lock (todo.transforms) { todo.transforms = transforms; } } } } #endif } } //if taking a long time, offer to disable for this package if (dtToDoBuildingStartTime.AddSeconds(MAX_SECONDS_BUILDING_TO_DOS_BEFORE_OFFER_DISABLE) < DateTime.Now && !disableHighlighting.ContainsKey(win)) { //it took more than 10 seconds to build the to do's list... offer that we disable highlighting for this package DialogResult result = MessageBox.Show("BIDS Helper Expression and Configuration Highlighting is taking a very long time to complete.\r\nThis can occur sometimes with complex packages.\r\n\r\nWould you like to disable highlighting on this package until you reopen it?\r\n\r\n(You may also completely disable the feature on all packages via Tools... Options... BIDS Helper.)", "BIDS Helper Expression and Configuration Highlighter Performance", MessageBoxButtons.YesNo); disableHighlighting.Add(win, (result == DialogResult.Yes)); if (result == DialogResult.Yes) return; } //only scan configurations if... //1. it's a full load (not incremental) //2. it's a full rescan //even in project deployment model in Denali you can continue using configurations, so go ahead and run this code as it won't be expensive unless there are configurations if (!bIncremental && bRescan) HighlightingToDo.CachePackageConfigurations(package, pi); StartToDosThread(dtSynchronousHighlightingCutoff); } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex.Message + " " + ex.StackTrace); } }
public bool OnError(DtsObject source, int errorCode, string subComponent, string description, string helpFile, int helpContext, string idofInterfaceWithError) { _context.LogInfo("OnWarning: errorCode: {0}, subComponent: {1}, description: {2}", errorCode, subComponent, description); return false; }
/// <summary> /// /// </summary> /// <param name="source"></param> /// <param name="errorCode"></param> /// <param name="subComponent"></param> /// <param name="description"></param> /// <param name="helpFile"></param> /// <param name="helpContext"></param> /// <param name="idofInterfaceWithError"></param> /// <returns></returns> public override bool OnError(DtsObject source, int errorCode, string subComponent, string description, string helpFile, int helpContext, string idofInterfaceWithError) { // Add application-specific diagnostics here. string error = string.Format("Error in {0}/{1} : {2}", source, subComponent, description); errores.Add(error); return false; }
void IDTSEvents.OnInformation(DtsObject source, int informationCode, string subComponent, string description, string helpFile, int helpContext, string idofInterfaceWithError, ref bool fireAgain) { LogDtsEventInformation( "source:{@source} informationCode:{informationCode} subComponent={subComponent} description={description} ", new object[] { source, informationCode, subComponent, description }); }
public void OnWarning(DtsObject source, int warningCode, string subComponent, string description, string helpFile, int helpContext, string idofInterfaceWithError) { Console.WriteLine("[Warning] {0}: {1}", subComponent, description); }
public override bool OnError(DtsObject source, int errorCode, string subComponent, string description, string helpFile, int helpContext, string idofInterfaceWithError) { _errorStream.WriteLine("SSIS Error in {0}/{1} : {2}", source, subComponent, description); return(false); }
public bool OnError(DtsObject source, int errorCode, string subComponent, string description, string helpFile, int helpContext, string idofInterfaceWithError) { Console.WriteLine("[Error] {0}: {1}", subComponent, description); return true; }
public void OnInformation(DtsObject source, int informationCode, string subComponent, string description, string helpFile, int helpContext, string idofInterfaceWithError, ref bool fireAgain) { }
public void OnInformation(DtsObject source, int informationCode, string subComponent, string description, string helpFile, int helpContext, string idofInterfaceWithError, ref bool fireAgain) { _context.LogInfo("OnWarning: informationCode: {0}, subComponent: {1}, description: {2}", informationCode, subComponent, description); }
private object SetPropertyValue(DtsObject dtsObject, string propertyPath, object value) { propertyPath = propertyPath.Replace("\\", "."); object returnValue = null; string firstPart = propertyPath; string restOfString = string.Empty; if (propertyPath.Contains(".")) { //Can have periods in object names (like connection manager names) //Need to verify that period is not between an index marker int delimiterIndex = propertyPath.IndexOf("."); //while (delimiterIndex > propertyPath.IndexOf("[") && // delimiterIndex < propertyPath.IndexOf("]")) //{ // delimiterIndex = propertyPath.IndexOf(".", delimiterIndex + 1 ); //} if (delimiterIndex > propertyPath.IndexOf("[") && delimiterIndex < propertyPath.IndexOf("]")) { delimiterIndex = propertyPath.IndexOf(".", propertyPath.IndexOf("]")); } if (delimiterIndex > -1) { firstPart = propertyPath.Substring(0, delimiterIndex); restOfString = propertyPath.Substring(delimiterIndex + 1, (propertyPath.Length - (delimiterIndex + 1))); if (firstPart.Length == 0) { return(SetPropertyValue(dtsObject, restOfString, value)); } } } if (firstPart.ToUpper().StartsWith("PACKAGE")) { if (!(dtsObject is Package)) { throw new ArgumentException("The initial object must be of type Package.", "dtsObject"); } return(SetPropertyValue(dtsObject, restOfString, value)); } // \Package.Variables[User::TestVar].Properties[Value] if (firstPart.ToUpper().StartsWith("VARIABLES")) { if (!(dtsObject is DtsContainer)) { throw new ArgumentException("Object must be of type DtsContainer to reference variables.", "dtsObject"); } Variables vars = null; string varName = GetSubStringBetween(firstPart, "[", "]"); DtsContainer cont = (DtsContainer)dtsObject; cont.VariableDispenser.LockOneForRead(varName, ref vars); returnValue = SetPropertyValue(vars[varName], restOfString, value); vars.Unlock(); return(returnValue); } // \Package.Properties[CreationDate] if (firstPart.ToUpper().StartsWith("PROPERTIES")) { if (!(dtsObject is IDTSPropertiesProvider)) { throw new ArgumentException("Object must be of type IDTSPropertiesProvider to reference properties.", "dtsObject"); } IDTSPropertiesProvider propProv = (IDTSPropertiesProvider)dtsObject; string propIndex = GetSubStringBetween(firstPart, "[", "]"); DtsProperty prop = propProv.Properties[propIndex]; if (dtsObject is Variable && prop.Name == "Value") { Variable var = (Variable)dtsObject; prop.SetValue(dtsObject, Convert.ChangeType(value, var.DataType)); } else { prop.SetValue(dtsObject, Convert.ChangeType(value, propProv.Properties[propIndex].Type)); } //Flag value as changing changesvc.OnComponentChanging(prop, null); changesvc.OnComponentChanged(prop, null, null, null); //marks the package designer as dirty return(prop.GetValue(dtsObject)); } // \Package.Connections[localhost.AdventureWorksDW2008].Properties[Description] if (firstPart.ToUpper().StartsWith("CONNECTIONS")) { if (!(dtsObject is Package)) { throw new ArgumentException("Object must be of type Package to reference Connections.", "dtsObject"); } string connIndex = GetSubStringBetween(firstPart, "[", "]"); Package pkg = (Package)dtsObject; return(SetPropertyValue(pkg.Connections[connIndex], restOfString, value)); } // \Package.EventHandlers[OnError].Properties[Description] if (firstPart.ToUpper().StartsWith("EVENTHANDLERS")) { if (!(dtsObject is EventsProvider)) { throw new ArgumentException("Object must be of type EventsProvider to reference events.", "dtsObject"); } EventsProvider eventProvider = (EventsProvider)dtsObject; string eventIndex = GetSubStringBetween(firstPart, "[", "]"); return(SetPropertyValue(eventProvider.EventHandlers[eventIndex], restOfString, value)); } //First Part of string is not one of the hard-coded values - it's either a task or container if (!(dtsObject is IDTSSequence)) { throw new ArgumentException("Object must be of type IDTSSequence to reference other tasks or containers.", "dtsObject"); } IDTSSequence seq = (IDTSSequence)dtsObject; if (seq.Executables.Contains(firstPart)) { return(SetPropertyValue(seq.Executables[firstPart], restOfString, value)); } // \Package\Sequence Container\Script Task.Properties[Description] // \Package\Sequence Container.Properties[Description] // \Package\Execute SQL Task.Properties[Description] //\Package.EventHandlers[OnError].Variables[System::Cancel].Properties[Value] // \Package.EventHandlers[OnError]\Script Task.Properties[Description] if (restOfString.Length > 0) { returnValue = SetPropertyValue(dtsObject, restOfString, value); } return(returnValue); }
public void OnWarning(DtsObject source, int warningCode, string subComponent, string description, string helpFile, int helpContext, string idofInterfaceWithError) { _builder.AppendLine(String.Format( "[{3}] WARNING: [{0}] [{1}] [{2}]", warningCode, subComponent, description )); }
private object LocatePropertyValue(object project, DtsObject dtsObject, string propertyPath, PropertyOperation operation, object value) { propertyPath = propertyPath.Replace("\\", "."); object returnValue = null; string firstPart = propertyPath; string restOfString = string.Empty; if (propertyPath.Contains(".")) { // Can have periods in object names (like connection manager names) // Need to verify that period is not between an index marker int delimiterIndex = propertyPath.IndexOf(".", StringComparison.Ordinal); if (delimiterIndex > propertyPath.IndexOf("[", StringComparison.Ordinal) && delimiterIndex < propertyPath.IndexOf("]", StringComparison.Ordinal)) { delimiterIndex = propertyPath.IndexOf(".", propertyPath.IndexOf("]", StringComparison.Ordinal), StringComparison.Ordinal); } if (delimiterIndex > -1) { firstPart = propertyPath.Substring(0, delimiterIndex); restOfString = propertyPath.Substring(delimiterIndex + 1, propertyPath.Length - (delimiterIndex + 1)); if (firstPart.Length == 0) { return(LocatePropertyValue(project, dtsObject, restOfString, operation, value)); } } } //\Project\ConnectionManagers[localhost.AdventureWorks2012.conmgr].Properties[ConnectionString] //\Project\Properties[ProtectionLevel] if (firstPart.ToUpper().StartsWith("PROJECT")) { if (!(project is Project)) { throw new ArgumentException("The initial object must be of type Project.", "project"); } return(LocatePropertyValue(project, (DtsObject)project, restOfString, operation, value)); } //\Project\ConnectionManagers[localhost.AdventureWorks2012.conmgr].Properties[ConnectionString] if (firstPart.ToUpper().StartsWith("CONNECTIONMANAGERS")) { string connIndex = GetSubStringBetween(firstPart, "[", "]"); ConnectionManager cm = (((Project)project).ConnectionManagerItems[connIndex]).ConnectionManager; return(LocatePropertyValue(project, cm, restOfString, operation, value)); } if (firstPart.ToUpper().StartsWith("PACKAGE")) { if (!(dtsObject is Package)) { throw new ArgumentException("The initial object must be of type Package.", "dtsObject"); } return(LocatePropertyValue(project, dtsObject, restOfString, operation, value)); } if (firstPart.ToUpper().StartsWith("VARIABLES")) { if (!(dtsObject is DtsContainer)) { throw new ArgumentException("Object must be of type DtsContainer to reference variables.", "dtsObject"); } Variables vars = null; string varName = GetSubStringBetween(firstPart, "[", "]"); DtsContainer cont = (DtsContainer)dtsObject; cont.VariableDispenser.LockOneForRead(varName, ref vars); returnValue = LocatePropertyValue(project, vars[varName], restOfString, operation, value); vars.Unlock(); return(returnValue); } // \Package.Properties[CreationDate] if (firstPart.ToUpper().StartsWith("PROPERTIES")) { string propIndex = GetSubStringBetween(firstPart, "[", "]"); if (!(dtsObject is IDTSPropertiesProvider)) { if (!(dtsObject is Project)) { throw new ArgumentException("Object must be of type Project or IDTSPropertiesProvider to reference properties.", "dtsObject"); } else { if (operation == PropertyOperation.Set) { dtsObject.GetType().GetProperty(propIndex).SetValue(dtsObject, Convert.ChangeType(value, dtsObject.GetType())); } return(dtsObject.GetType().GetProperty(propIndex).GetValue(dtsObject, null)); } } IDTSPropertiesProvider propProv = (IDTSPropertiesProvider)dtsObject; DtsProperty prop = propProv.Properties[propIndex]; if (operation == PropertyOperation.Set) { if (dtsObject is Variable) { Variable var = (Variable)dtsObject; prop.SetValue(dtsObject, Convert.ChangeType(value, var.DataType)); } else { prop.SetValue(dtsObject, Convert.ChangeType(value, propProv.Properties[propIndex].Type)); } } return(prop.GetValue(dtsObject)); } // \Package.Connections[localhost.AdventureWorksDW2008].Properties[Description] if (firstPart.ToUpper().StartsWith("CONNECTIONS")) { if (!(dtsObject is Package)) { throw new ArgumentException("Object must be of type Package to reference Connections.", "dtsObject"); } string connIndex = GetSubStringBetween(firstPart, "[", "]"); Package pkg = (Package)dtsObject; return(LocatePropertyValue(project, pkg.Connections[connIndex], restOfString, operation, value)); } // \Package.EventHandlers[OnError].Properties[Description] if (firstPart.ToUpper().StartsWith("EVENTHANDLERS")) { if (!(dtsObject is EventsProvider)) { throw new ArgumentException("Object must be of type EventsProvider to reference events.", "dtsObject"); } EventsProvider eventProvider = (EventsProvider)dtsObject; string eventIndex = GetSubStringBetween(firstPart, "[", "]"); return(LocatePropertyValue(project, eventProvider.EventHandlers[eventIndex], restOfString, operation, value)); } // First Part of string is not one of the hard-coded values - it's either a task or container if (!(dtsObject is IDTSSequence)) { throw new ArgumentException("Object must be of type IDTSSequence to reference other tasks or containers.", "dtsObject"); } IDTSSequence seq = (IDTSSequence)dtsObject; if (seq.Executables.Contains(firstPart)) { return(LocatePropertyValue(project, seq.Executables[firstPart], restOfString, operation, value)); } // \Package\Sequence Container\Script Task.Properties[Description] // \Package\Sequence Container.Properties[Description] // \Package\Execute SQL Task.Properties[Description] // \Package.EventHandlers[OnError].Variables[System::Cancel].Properties[Value] // \Package.EventHandlers[OnError]\Script Task.Properties[Description] if (restOfString.Length > 0) { returnValue = LocatePropertyValue(project, dtsObject, restOfString, operation, value); } return(returnValue); }
public override bool OnError(DtsObject source, int errorCode, string subComponent, string description, string helpFile, int helpContext, string idofInterfaceWithError) { HandleEvent("Error", errorCode, subComponent, description); return(base.OnError(source, errorCode, subComponent, description, helpFile, helpContext, idofInterfaceWithError)); }
public override bool OnError(DtsObject source, int errorCode, string subComponent, string description, string helpFile, int helpContext, string idofInterfaceWithError) { Logger.Error($"[Validate] Source: {source}\nSubComponent: {subComponent}\nDescription {description}"); return(false); }
public override void OnInformation(DtsObject source, int informationCode, string subComponent, string description, string helpFile, int helpContext, string idofInterfaceWithError, ref bool fireAgain) { HandleEvent("Information", informationCode, subComponent, description); base.OnInformation(source, informationCode, subComponent, description, helpFile, helpContext, idofInterfaceWithError, ref fireAgain); }
bool IDTSEvents.OnError(DtsObject source, int errorCode, string subComponent, string description, string helpFile, int helpContext, string idofInterfaceWithError) { return(false); }
public override void OnWarning(DtsObject source, int warningCode, string subComponent, string description, string helpFile, int helpContext, string idofInterfaceWithError) { HandleEvent("Warning", warningCode, subComponent, description); base.OnWarning(source, warningCode, subComponent, description, helpFile, helpContext, idofInterfaceWithError); }
public override bool OnError(DtsObject source, int errorCode, string subComponent, string description, string helpFile, int helpContext, string idofInterfaceWithError) { // Add application-specific diagnostics here. string str = source + "<br>" + subComponent + "<br>" + description; return false; }
private void BuildToDos(Window GotFocus, DtsObject oIncrementalObject) { BuildToDos(GotFocus, oIncrementalObject, null); }
public override void OnWarning(DtsObject source, int warningCode, string subComponent, string description, string helpFile, int helpContext, string idofInterfaceWithError) { // TODO: Add custom code to handle the event. PrintOutput.PrintToOutput(String.Format(CultureInfo.InvariantCulture, "Warning: {0} - {1}", warningCode, description), DERun.Debug); }
private void ScanIntegrationServicesExecutableForPropertiesWithNonDefaultValue(DtsObject o, string FriendlyPath) { if (o == null) return; if (packageDefault == null) { packageDefault = new Package(); } DtsObject defaultObject; if (o is Package) { defaultObject = packageDefault; } else if (o is IDTSName) { if (dictCachedDtsObjects.ContainsKey(((IDTSName)o).CreationName)) { defaultObject = dictCachedDtsObjects[((IDTSName)o).CreationName]; } else if (o is DtsEventHandler) { defaultObject = (DtsObject)packageDefault.EventHandlers.Add(((IDTSName)o).CreationName); dictCachedDtsObjects.Add(((IDTSName)o).CreationName, defaultObject); } else if (o is ConnectionManager) { defaultObject = (DtsObject)packageDefault.Connections.Add(((IDTSName)o).CreationName); dictCachedDtsObjects.Add(((IDTSName)o).CreationName, defaultObject); } else { defaultObject = packageDefault.Executables.Add(((IDTSName)o).CreationName); dictCachedDtsObjects.Add(((IDTSName)o).CreationName, defaultObject); } } else { throw new Exception("Object " + o.GetType().FullName + " does not implement IDTSName."); } PropertyInfo[] properties = o.GetType().GetProperties(BindingFlags.Public | BindingFlags.FlattenHierarchy | BindingFlags.Instance); foreach (PropertyInfo prop in properties) { if (!prop.CanWrite || !prop.CanRead) continue; //SSIS objects don't have a DefaultValueAttribute, which is wy we have to create a new control flow object (defaultObject) above and compare properties from this object to that object object[] attrs = prop.GetCustomAttributes(typeof(System.ComponentModel.BrowsableAttribute), true); System.ComponentModel.BrowsableAttribute browsableAttr = (System.ComponentModel.BrowsableAttribute)(attrs.Length > 0 ? attrs[0] : null); if (browsableAttr != null && !browsableAttr.Browsable) continue; //don't show attributes marked not browsable attrs = prop.GetCustomAttributes(typeof(System.ComponentModel.ReadOnlyAttribute), true); System.ComponentModel.ReadOnlyAttribute readOnlyAttr = (System.ComponentModel.ReadOnlyAttribute)(attrs.Length > 0 ? attrs[0] : null); if (readOnlyAttr != null && readOnlyAttr.IsReadOnly) continue; //don't show attributes marked read only if (prop.PropertyType.Namespace != "System" && !prop.PropertyType.IsPrimitive && !prop.PropertyType.IsValueType && !prop.PropertyType.IsEnum) continue; if (prop.PropertyType == typeof(DateTime)) continue; if (prop.PropertyType == typeof(string)) continue; if (prop.Name == "VersionBuild") continue; if (prop.Name == "VersionMajor") continue; if (prop.Name == "VersionMinor") continue; if (prop.Name == "PackageType") continue; object value = prop.GetValue(o, null); object defaultValue = prop.GetValue(defaultObject, null); if (defaultValue != null && !defaultValue.Equals(value)) { string sValue = (value == null ? string.Empty : value.ToString()); this.listNonDefaultProperties.Add(new NonDefaultProperty(this.DatabaseName, FriendlyPath, prop.Name, defaultValue.ToString(), sValue)); } } if (o is IDTSObjectHost) { IDTSObjectHost host = (IDTSObjectHost)o; if (host.InnerObject is Microsoft.SqlServer.Dts.Pipeline.Wrapper.MainPipe) properties = typeof(Microsoft.SqlServer.Dts.Pipeline.Wrapper.MainPipeClass).GetProperties(BindingFlags.Public | BindingFlags.FlattenHierarchy | BindingFlags.Instance); else if (host.InnerObject is IDTSConnectionManagerDatabaseParametersXX) properties = typeof(IDTSConnectionManagerDatabaseParametersXX).GetProperties(BindingFlags.Public | BindingFlags.FlattenHierarchy | BindingFlags.Instance); else //probably won't turn up any properties because reflection on a COM object Type doesn't work properties = host.InnerObject.GetType().GetProperties(BindingFlags.Public | BindingFlags.FlattenHierarchy | BindingFlags.Instance); foreach (PropertyInfo prop in properties) { if (!prop.CanWrite || !prop.CanRead) continue; object[] attrs = prop.GetCustomAttributes(typeof(System.ComponentModel.BrowsableAttribute), true); System.ComponentModel.BrowsableAttribute browsableAttr = (System.ComponentModel.BrowsableAttribute)(attrs.Length > 0 ? attrs[0] : null); if (browsableAttr != null && !browsableAttr.Browsable) continue; //don't show attributes marked not browsable attrs = prop.GetCustomAttributes(typeof(System.ComponentModel.ReadOnlyAttribute), true); System.ComponentModel.ReadOnlyAttribute readOnlyAttr = (System.ComponentModel.ReadOnlyAttribute)(attrs.Length > 0 ? attrs[0] : null); if (readOnlyAttr != null && readOnlyAttr.IsReadOnly) continue; //don't show attributes marked read only if (prop.PropertyType.Namespace != "System" && !prop.PropertyType.IsPrimitive && !prop.PropertyType.IsValueType && !prop.PropertyType.IsEnum) continue; if (prop.PropertyType == typeof(DateTime)) continue; if (prop.PropertyType == typeof(string)) continue; if (prop.Name == "VersionBuild") continue; if (prop.Name == "VersionMajor") continue; if (prop.Name == "VersionMinor") continue; if (prop.Name == "PackageType") continue; if (prop.Name.StartsWith("IDTS")) continue; object value; object defaultValue; if (host.InnerObject is Microsoft.SqlServer.Dts.Pipeline.Wrapper.MainPipe) { try { value = host.InnerObject.GetType().InvokeMember(prop.Name, System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.GetProperty | System.Reflection.BindingFlags.FlattenHierarchy | System.Reflection.BindingFlags.Instance, null, host.InnerObject, null); } catch { continue; } try { defaultValue = ((IDTSObjectHost)defaultObject).InnerObject.GetType().InvokeMember(prop.Name, System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.GetProperty | System.Reflection.BindingFlags.FlattenHierarchy | System.Reflection.BindingFlags.Instance, null, ((IDTSObjectHost)defaultObject).InnerObject, null); } catch { defaultValue = null; } } else { value = prop.GetValue(host.InnerObject, null); defaultValue = prop.GetValue(((IDTSObjectHost)defaultObject).InnerObject, null); } if (defaultValue != null && !defaultValue.Equals(value)) { string sValue = (value == null ? string.Empty : value.ToString()); this.listNonDefaultProperties.Add(new NonDefaultProperty(this.DatabaseName, FriendlyPath, prop.Name, defaultValue.ToString(), sValue)); } } //scan data flow transforms if (host.InnerObject is Microsoft.SqlServer.Dts.Pipeline.Wrapper.MainPipe) { Microsoft.SqlServer.Dts.Pipeline.Wrapper.MainPipe pipe = (Microsoft.SqlServer.Dts.Pipeline.Wrapper.MainPipe)host.InnerObject; Microsoft.SqlServer.Dts.Pipeline.Wrapper.MainPipe defaultPipe = (Microsoft.SqlServer.Dts.Pipeline.Wrapper.MainPipe)((IDTSObjectHost)defaultObject).InnerObject; foreach (IDTSComponentMetaDataXX transform in pipe.ComponentMetaDataCollection) { IDTSComponentMetaDataXX defaultTransform = defaultPipe.ComponentMetaDataCollection.New(); defaultTransform.ComponentClassID = transform.ComponentClassID; CManagedComponentWrapper defaultInst = defaultTransform.Instantiate(); try { defaultInst.ProvideComponentProperties(); } catch { continue; //if there's a corrupt package (or if you don't have the component installed on your laptop?) then this might fail... so just move on } if (!transform.ValidateExternalMetadata) //this property isn't in the CustomPropertyCollection, so we have to check it manually { this.listNonDefaultProperties.Add(new NonDefaultProperty(this.DatabaseName, FriendlyPath + "\\" + transform.Name, "ValidateExternalMetadata", "True", "False")); } foreach (IDTSOutputXX output in transform.OutputCollection) //check for error row dispositions { if (output.ErrorRowDisposition == DTSRowDisposition.RD_IgnoreFailure) { this.listNonDefaultProperties.Add(new NonDefaultProperty(this.DatabaseName, FriendlyPath + "\\" + transform.Name + "\\" + output.Name, "ErrorRowDisposition", "FailComponent", "IgnoreFailure")); } if (output.TruncationRowDisposition == DTSRowDisposition.RD_IgnoreFailure) { this.listNonDefaultProperties.Add(new NonDefaultProperty(this.DatabaseName, FriendlyPath + "\\" + transform.Name + "\\" + output.Name, "TruncationRowDisposition", "FailComponent", "IgnoreFailure")); } } Microsoft.DataTransformationServices.Design.PipelinePropertiesWrapper propWrapper = new Microsoft.DataTransformationServices.Design.PipelinePropertiesWrapper(transform, transform, 0); foreach (IDTSCustomPropertyXX prop in transform.CustomPropertyCollection) { System.ComponentModel.PropertyDescriptor propDesc = (System.ComponentModel.PropertyDescriptor)propWrapper.GetType().InvokeMember("CreateCustomPropertyPropertyDescriptor", BindingFlags.DeclaredOnly | BindingFlags.NonPublic | BindingFlags.InvokeMethod | BindingFlags.Instance, null, propWrapper, new object[] { prop }); if (propDesc == null) continue; if (propDesc.IsReadOnly) continue; if (!propDesc.IsBrowsable) continue; if (prop.Value is string) continue; if (prop.Value is DateTime) continue; IDTSCustomPropertyXX defaultProp; try { defaultProp = defaultTransform.CustomPropertyCollection[prop.Name]; } catch { if (prop.Name == "PreCompile" && bool.Equals(prop.Value, false)) //this property doesn't show up in the new script component we created to determine defaults, so we have to check it manually { this.listNonDefaultProperties.Add(new NonDefaultProperty(this.DatabaseName, FriendlyPath + "\\" + transform.Name, prop.Name, "True", "False")); } continue; } System.ComponentModel.ITypeDescriptorContext context = new PipelinePropertyContext(transform, propDesc); string sValue = propDesc.Converter.ConvertToString(context, prop.Value); //gets nice text descriptions for enums on component properties string sDefaultValue = propDesc.Converter.ConvertToString(context, defaultProp.Value); //gets nice text descriptions for enums on component properties if (sValue == sDefaultValue) continue; this.listNonDefaultProperties.Add(new NonDefaultProperty(this.DatabaseName, FriendlyPath + "\\" + transform.Name, prop.Name, sDefaultValue, sValue)); } defaultPipe.ComponentMetaDataCollection.RemoveObjectByID(defaultTransform.ID); } } } }
public override bool OnError(DtsObject source, int errorCode, string subComponent, string description, string helpFile, int helpContext, string idofInterfaceWithError) { // TODO: Add custom code to handle the event. PrintOutput.PrintToOutput(String.Format(CultureInfo.InvariantCulture, "Error: {0} - {1}", errorCode, description), DERun.Debug); return(true); }
public void OnWarning(DtsObject source, int warningCode, string subComponent, string description, string helpFile, int helpContext, string idofInterfaceWithError) { _context.LogWarning("OnWarning: warningCode: {0}, subComponent: {1}, description: {2}", warningCode, subComponent, description); }