/// <summary> /// Will ensure that the SSDT has the credentials (SQL auth and impersonation info) so that when we alter the whole database object it won't wipe out the data source credentials /// </summary> /// <param name="sandbox"></param> public static bool EnsureDataSourceCredentials(Microsoft.AnalysisServices.BackEnd.DataModelingSandbox sandbox) { System.Collections.Generic.List <string> dataSourceIDs = new System.Collections.Generic.List <string>(); #if DENALI || SQL2014 Database db = sandbox.Database; foreach (DataSource ds in db.DataSources) { if (ds.ConnectionString != "Provider=None") //for pushed data source (pasted data) skip { dataSourceIDs.Add(ds.ID); } } #else foreach (Microsoft.AnalysisServices.BackEnd.DataModelingDataSource ds in sandbox.DataSources) { if (ds.ConnectionString != "Provider=None" && !ds.IsStructuredDataSource) //for pushed data source (pasted data) skip { dataSourceIDs.Add(ds.ID); } } #endif foreach (string sDataSourceID in dataSourceIDs) { if (!Microsoft.AnalysisServices.Common.CommonFunctions.HandlePasswordPrompt(null, sandbox, sDataSourceID, null)) { return(false); } if (!Microsoft.AnalysisServices.Common.CommonFunctions.HandlePasswordPromptForImpersonation(null, sandbox, sDataSourceID, null)) { return(false); } } return(true); }
private Level[] GetProblemLevels(Microsoft.AnalysisServices.BackEnd.DataModelingSandbox sandboxParam) { #if DENALI || SQL2014 var sandbox = sandboxParam; #else var sandbox = (Microsoft.AnalysisServices.BackEnd.DataModelingSandboxAmo)sandboxParam.Impl; #endif List <Level> levels = new List <Level>(); SSAS.TabularHideMemberIfAnnotation annotation = GetAnnotation(sandboxParam); foreach (Dimension d in sandbox.Database.Dimensions) { foreach (Hierarchy h in d.Hierarchies) { foreach (Level l in h.Levels) { SSAS.TabularLevelHideMemberIf levelAnnotation = annotation.Find(l); if (levelAnnotation != null) { if (levelAnnotation.HideMemberIf != l.HideMemberIf) { levels.Add(l); } } } } } return(levels.ToArray()); }
internal void ExecuteSyncDescriptions(Microsoft.AnalysisServices.BackEnd.DataModelingSandbox sandbox, IServiceProvider provider, string tableName) { try { Microsoft.AnalysisServices.BackEnd.DataModelingSandbox.AMOCode code = delegate { int iDescriptionsSet; Microsoft.AnalysisServices.BackEnd.SandboxTransactionProperties properties = new Microsoft.AnalysisServices.BackEnd.SandboxTransactionProperties(); properties.RecalcBehavior = Microsoft.AnalysisServices.BackEnd.TransactionRecalcBehavior.Default; using (Microsoft.AnalysisServices.BackEnd.SandboxTransaction tran = sandbox.CreateTransaction(properties)) { if (!TabularHelpers.EnsureDataSourceCredentials(sandbox)) { MessageBox.Show("Cancelling Sync Descriptions because data source credentials were not entered.", "BIDS Helper Tabular Sync Descriptions - Cancelled!"); tran.RollbackAndContinue(); return; } Dimension d = sandbox.Database.Dimensions.GetByName(tableName); iDescriptionsSet = SyncDescriptionsPlugin.SyncDescriptions(d, true, provider, true); sandbox.Database.Update(UpdateOptions.ExpandFull); tran.Commit(); } MessageBox.Show("Set " + iDescriptionsSet + " descriptions successfully.", "BIDS Helper - Sync Descriptions"); }; sandbox.ExecuteAMOCode(Microsoft.AnalysisServices.BackEnd.DataModelingSandbox.OperationType.Update, Microsoft.AnalysisServices.BackEnd.DataModelingSandbox.OperationCancellability.AlwaysExecute, code, true); } catch (System.Exception ex) { MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace, "BIDS Helper - Error"); } }
private void BuildEvents_OnBuildBegin(vsBuildScope Scope, vsBuildAction Action) { if (!this.Enabled) { return; } if (Action == vsBuildAction.vsBuildActionClean) { return; } foreach (UIHierarchyItem hierItem in VisualStudioHelpers.GetAllItemsFromSolutionExplorer(this.ApplicationObject.ToolWindows.SolutionExplorer)) { if (hierItem.Name != null && hierItem.Name.ToLower().EndsWith(".bim")) { Microsoft.AnalysisServices.BackEnd.DataModelingSandbox sandbox = TabularHelpers.GetTabularSandboxFromBimFile(hierItem, false); if (sandbox != null) { List <BIDSHelperPluginBase> checks = new List <BIDSHelperPluginBase>(); foreach (BIDSHelperPluginBase plugin in Connect.Plugins.Values) { Type t = plugin.GetType(); if (plugin is ITabularOnPreBuildAnnotationCheck && !t.IsInterface && !t.IsAbstract) { ITabularOnPreBuildAnnotationCheck check = (ITabularOnPreBuildAnnotationCheck)plugin; if (check.TabularOnPreBuildAnnotationCheckPriority == TabularOnPreBuildAnnotationCheckPriority.HighPriority) { checks.Insert(0, plugin); //insert the high priority checks at the front of the list so they get run first } else { checks.Add(plugin); } } } foreach (BIDSHelperPluginBase plugin in checks) { ITabularOnPreBuildAnnotationCheck check = (ITabularOnPreBuildAnnotationCheck)plugin; string sWarning = check.GetPreBuildWarning(sandbox); if (sWarning != null) { if (MessageBox.Show(sWarning, "BIDS Helper Pre-Build Warning - " + plugin.FeatureName, MessageBoxButtons.OKCancel) == DialogResult.OK) { Microsoft.VisualStudio.Project.Automation.OAFileItem project = hierItem.Object as Microsoft.VisualStudio.Project.Automation.OAFileItem; Window win = project.Open(EnvDTE.Constants.vsViewKindPrimary); win.Activate(); check.FixPreBuildWarning(sandbox); project.Save(hierItem.Name); } } } } } } }
internal void SetHideMemberIf(Microsoft.AnalysisServices.BackEnd.DataModelingSandbox sandbox, IEnumerable <Tuple <string, string, string> > hierarchyLevels, List <HideIfValue> newValues) { try { Microsoft.AnalysisServices.BackEnd.DataModelingSandbox.AMOCode code = delegate { Microsoft.AnalysisServices.BackEnd.SandboxTransactionProperties properties = new Microsoft.AnalysisServices.BackEnd.SandboxTransactionProperties(); properties.RecalcBehavior = Microsoft.AnalysisServices.BackEnd.TransactionRecalcBehavior.AlwaysRecalc; List <Dimension> dims = new List <Dimension>(); using (Microsoft.AnalysisServices.BackEnd.SandboxTransaction tran = sandbox.CreateTransaction(properties)) { if (!TabularHelpers.EnsureDataSourceCredentials(sandbox)) { MessageBox.Show("Cancelling apply of HideMemberIf because data source credentials were not entered.", "BIDS Helper Tabular HideMemberIf - Cancelled!"); tran.RollbackAndContinue(); return; } SSAS.TabularHideMemberIfAnnotation annotation = GetAnnotation(sandbox); foreach (Tuple <string, string, string> tuple in hierarchyLevels) { Dimension d = sandbox.Database.Dimensions.GetByName(tuple.Item1); if (!dims.Contains(d)) { dims.Add(d); } Hierarchy h = d.Hierarchies.GetByName(tuple.Item2); Level l = h.Levels.GetByName(tuple.Item3); l.HideMemberIf = newValues[0]; newValues.RemoveAt(0); annotation.Set(l); } TabularHelpers.SaveXmlAnnotation(sandbox.Database, HIDEMEMBERIF_ANNOTATION, annotation); sandbox.Database.Update(UpdateOptions.ExpandFull); //bug in AS2012 (still not working in RTM CU1) requires ProcessFull to successfully switch from HideMemberIf=Never to NoName foreach (Dimension d in dims) { d.Process(ProcessType.ProcessFull); } tran.Commit(); } }; sandbox.ExecuteAMOCode(Microsoft.AnalysisServices.BackEnd.DataModelingSandbox.OperationType.Update, Microsoft.AnalysisServices.BackEnd.DataModelingSandbox.OperationCancellability.AlwaysExecute, code, true); } catch (System.Exception ex) { MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace, "BIDS Helper - Error"); } }
public static SSAS.TabularDisplayFoldersAnnotation GetAnnotation(Microsoft.AnalysisServices.BackEnd.DataModelingSandbox sandbox) { SSAS.TabularDisplayFoldersAnnotation annotation = new SSAS.TabularDisplayFoldersAnnotation(); if (sandbox.Database.Annotations.Contains(DISPLAY_FOLDER_ANNOTATION)) { string xml = TabularHelpers.GetAnnotationXml(sandbox.Database, DISPLAY_FOLDER_ANNOTATION); System.Xml.Serialization.XmlSerializer serializer = new System.Xml.Serialization.XmlSerializer(typeof(SSAS.TabularDisplayFoldersAnnotation)); annotation = (SSAS.TabularDisplayFoldersAnnotation)serializer.Deserialize(new System.IO.StringReader(xml)); } return(annotation); }
private SSAS.TabularTranslationsAnnotation GetAnnotation(Microsoft.AnalysisServices.BackEnd.DataModelingSandbox sandbox) { SSAS.TabularTranslationsAnnotation annotation = new SSAS.TabularTranslationsAnnotation(); if (sandbox.Database.Annotations.Contains(TRANSLATIONS_ANNOTATION)) { string xml = TabularHelpers.GetAnnotationXml(sandbox.Database, TRANSLATIONS_ANNOTATION); System.Xml.Serialization.XmlSerializer serializer = new System.Xml.Serialization.XmlSerializer(typeof(SSAS.TabularTranslationsAnnotation)); annotation = (SSAS.TabularTranslationsAnnotation)serializer.Deserialize(new System.IO.StringReader(xml)); } return(annotation); }
public string GetPreBuildWarning(Microsoft.AnalysisServices.BackEnd.DataModelingSandbox sandbox) { sandboxWrapper = new DataModelingSandboxWrapper(this); //sandbox = TabularHelpers.GetTabularSandboxFromBimFile(this, true); if (sandboxWrapper.GetSandbox() == null) { throw new Exception("Can't get Sandbox!"); } ExecInternal(true); return(null); //always return null since ExecInternal just handled it }
private void ExecSandbox(Microsoft.AnalysisServices.BackEnd.DataModelingSandbox sandboxParam) { try { sandbox = sandboxParam; if (sandbox == null) { throw new Exception("Can't get Sandbox!"); } cube = sandbox.Cube; if (cube == null) { throw new Exception("The workspace database cube doesn't exist."); } SSAS.TabularActionsEditorForm form = new SSAS.TabularActionsEditorForm(cube, sandbox.AdomdConnection); if (form.ShowDialog() == DialogResult.OK) { Microsoft.AnalysisServices.BackEnd.DataModelingSandbox.AMOCode code = delegate { using (Microsoft.AnalysisServices.BackEnd.SandboxTransaction tran = sandbox.CreateTransaction()) { foreach (Perspective p in cube.Perspectives) { p.Actions.Clear(); } cube.Actions.Clear(); foreach (Microsoft.AnalysisServices.Action action in form.Actions()) { cube.Actions.Add(action); foreach (Perspective p in cube.Perspectives) { if (form.ActionInPerspective(action.ID, p.ID)) { p.Actions.Add(action.ID); } } } TabularHelpers.SaveXmlAnnotation(cube, SSAS.TabularActionsEditorForm.ACTION_ANNOTATION, form.Annotation); cube.Update(UpdateOptions.ExpandFull); tran.Commit(); } }; sandbox.ExecuteAMOCode(Microsoft.AnalysisServices.BackEnd.DataModelingSandbox.OperationType.Update, Microsoft.AnalysisServices.BackEnd.DataModelingSandbox.OperationCancellability.AlwaysExecute, code, true); } } catch (System.Exception ex) { MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace, "BIDS Helper - Error"); } }
private SSAS.TabularHideMemberIfAnnotation GetAnnotation(Microsoft.AnalysisServices.BackEnd.DataModelingSandbox sandbox) { if (sandbox.Database.Annotations.Contains(HIDEMEMBERIF_ANNOTATION)) { string xml = TabularHelpers.GetAnnotationXml(sandbox.Database, HIDEMEMBERIF_ANNOTATION); System.Xml.Serialization.XmlSerializer serializer = new System.Xml.Serialization.XmlSerializer(typeof(BIDSHelper.SSAS.TabularHideMemberIfAnnotation)); return((SSAS.TabularHideMemberIfAnnotation)serializer.Deserialize(new System.IO.StringReader(xml))); } else { return(new SSAS.TabularHideMemberIfAnnotation()); } }
public override void Exec() { try { UIHierarchy solExplorer = this.ApplicationObject.ToolWindows.SolutionExplorer; UIHierarchyItem hierItem = (UIHierarchyItem)((System.Array)solExplorer.SelectedItems).GetValue(0); ProjectItem projItem = (ProjectItem)hierItem.Object; string sFileName = ((ProjectItem)hierItem.Object).Name.ToLower(); if (sFileName.EndsWith(".bim")) { #if DENALI || SQL2014 Microsoft.AnalysisServices.BackEnd.DataModelingSandbox sandbox = TabularHelpers.GetTabularSandboxFromBimFile(hierItem, true); foreach (DataSourceView o in sandbox.Database.DataSourceViews) { IterateDsvColumns(o); } #endif } else { DataSourceView dsv = (DataSourceView)projItem.Object; IterateDsvColumns(dsv); } if (unusedColumns.Count == 0) { MessageBox.Show("There are no unused columns.", "BIDS Helper - Unused Columns Report"); return; } ReportViewerForm frm = new ReportViewerForm(); frm.ReportBindingSource.DataSource = unusedColumns.Values; frm.Report = "SSAS.UnusedColumns.rdlc"; Microsoft.Reporting.WinForms.ReportDataSource reportDataSource1 = new Microsoft.Reporting.WinForms.ReportDataSource(); reportDataSource1.Name = "BIDSHelper_UnusedColumn"; reportDataSource1.Value = frm.ReportBindingSource; frm.ReportViewerControl.LocalReport.DataSources.Add(reportDataSource1); frm.ReportViewerControl.LocalReport.ReportEmbeddedResource = "SSAS.UnusedColumns.rdlc"; frm.Caption = "Unused Columns Report"; frm.WindowState = FormWindowState.Maximized; frm.Show(); } catch (System.Exception ex) { MessageBox.Show(ex.Message); } }
public void FixPreBuildWarning(Microsoft.AnalysisServices.BackEnd.DataModelingSandbox sandbox) { SSAS.TabularHideMemberIfAnnotation annotation = GetAnnotation(sandbox); List <Tuple <string, string, string> > levels = new List <Tuple <string, string, string> >(); List <HideIfValue> values = new List <HideIfValue>(); foreach (Level l in GetProblemLevels(sandbox)) { SSAS.TabularLevelHideMemberIf levelAnnotation = annotation.Find(l); levels.Add(new Tuple <string, string, string>(l.ParentDimension.Name, l.Parent.Name, l.Name)); values.Add(levelAnnotation.HideMemberIf); } SetHideMemberIf(sandbox, levels, values); }
internal HideIfValue GetHideMemberIf(IEnumerable <Tuple <string, string, string> > hierarchyLevels) { Microsoft.AnalysisServices.BackEnd.DataModelingSandbox sandbox = TabularHelpers.GetTabularSandboxFromActiveWindow(); if (sandbox != null) { foreach (Tuple <string, string, string> tuple in hierarchyLevels) { Dimension d = sandbox.Database.Dimensions.GetByName(tuple.Item1); Hierarchy h = d.Hierarchies.GetByName(tuple.Item2); Level l = h.Levels.GetByName(tuple.Item3); return(l.HideMemberIf); } } throw new Exception("Couldn't find HideMemberIf value."); }
public override void Exec() { try { UIHierarchy solExplorer = this.ApplicationObject.ToolWindows.SolutionExplorer; UIHierarchyItem hierItem = ((UIHierarchyItem)((System.Array)solExplorer.SelectedItems).GetValue(0)); sandbox = TabularHelpers.GetTabularSandboxFromBimFile(hierItem, true); ExecSandbox(sandbox); } catch (System.Exception ex) { MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace, "BIDS Helper - Error"); } }
public string GetPreBuildWarning(Microsoft.AnalysisServices.BackEnd.DataModelingSandbox sandbox) { string strWarning = "Click OK for BIDS Helper to restore display folders. The Tabular Display Folders form will open. Then click Yes then OK."; SSAS.TabularDisplayFoldersAnnotation annotation = GetAnnotation(sandbox); Database db = sandbox.Database; foreach (Dimension d in db.Dimensions) { foreach (DimensionAttribute da in d.Attributes) { if (da.Type != AttributeType.RowNumber && da.AttributeHierarchyVisible) { if (string.IsNullOrEmpty(da.AttributeHierarchyDisplayFolder) && annotation.Find(da) != null) { return(strWarning); } } } foreach (Hierarchy h in d.Hierarchies) { if (string.IsNullOrEmpty(h.DisplayFolder) && annotation.Find(h) != null) { return(strWarning); } } } foreach (Cube c in db.Cubes) { foreach (MdxScript mdx in c.MdxScripts) { foreach (CalculationProperty calc in mdx.CalculationProperties) { if (calc.Visible && !calc.CalculationReference.StartsWith("KPIs.")) //TODO: display folder for KPIs have to be set inline in MDX script... do this in the future { if (string.IsNullOrEmpty(calc.DisplayFolder) && annotation.Find(calc) != null) { return(strWarning); } } } } } return(null); }
private SSAS.TabularTranslationsAnnotation GetAnnotation(Microsoft.AnalysisServices.BackEnd.DataModelingSandbox sandbox) { SSAS.TabularTranslationsAnnotation annotation = new SSAS.TabularTranslationsAnnotation(); #if DENALI || SQL2014 var db = sandbox.Database; #else var db = ((Microsoft.AnalysisServices.BackEnd.DataModelingSandboxAmo)sandbox.Impl).Database; #endif if (db.Annotations.Contains(TRANSLATIONS_ANNOTATION)) { string xml = TabularHelpers.GetAnnotationXml(db, TRANSLATIONS_ANNOTATION); System.Xml.Serialization.XmlSerializer serializer = new System.Xml.Serialization.XmlSerializer(typeof(SSAS.TabularTranslationsAnnotation)); annotation = (SSAS.TabularTranslationsAnnotation)serializer.Deserialize(new System.IO.StringReader(xml)); } return(annotation); }
/// <summary> /// Will ensure that the SSDT has the credentials (SQL auth and impersonation info) so that when we alter the whole database object it won't wipe out the data source credentials /// </summary> /// <param name="sandbox"></param> public static bool EnsureDataSourceCredentials(Microsoft.AnalysisServices.BackEnd.DataModelingSandbox sandbox) { Database db = sandbox.Database; foreach (DataSource ds in db.DataSources) { if (!Microsoft.AnalysisServices.Common.CommonFunctions.HandlePasswordPrompt(null, sandbox, ds.ID, null)) { return(false); } if (!Microsoft.AnalysisServices.Common.CommonFunctions.HandlePasswordPromptForImpersonation(null, sandbox, ds.ID, null)) { return(false); } } return(true); }
public override void Exec() { try { UIHierarchy solExplorer = this.ApplicationObject.ToolWindows.SolutionExplorer; UIHierarchyItem hierItem = ((UIHierarchyItem)((System.Array)solExplorer.SelectedItems).GetValue(0)); //SolutionClass solution = hierItem.Object as SolutionClass; Microsoft.AnalysisServices.BackEnd.DataModelingSandbox sandbox = null; Database db = null; bool targetFound = false; if (hierItem.Object is EnvDTE.Project) { EnvDTE.Project p = (EnvDTE.Project)hierItem.Object; Microsoft.DataWarehouse.VsIntegration.Shell.Project.Extensibility.ProjectExt projExt = (Microsoft.DataWarehouse.VsIntegration.Shell.Project.Extensibility.ProjectExt)p; if (projExt.Kind == BIDSProjectKinds.SSAS) { db = (Database)p.Object; targetFound = true; } } if (hierItem.Object is ProjectItem) { string sFileName = ((ProjectItem)hierItem.Object).Name.ToLower(); if (sFileName.EndsWith(".bim")) { sandbox = TabularHelpers.GetTabularSandboxFromBimFile(hierItem, true); targetFound = true; } } if (targetFound) { RunCustomDesignRules(db, sandbox); } else { MessageBox.Show("No valid design rule target found"); } } catch (System.Exception ex) { MessageBox.Show(ex.Message); } }
public string GetPreBuildWarning(Microsoft.AnalysisServices.BackEnd.DataModelingSandbox sandbox) { #if DENALI || SQL2014 cube = sandbox.Cube; #else cube = ((Microsoft.AnalysisServices.BackEnd.DataModelingSandboxAmo)sandbox.Impl).Cube; #endif SSAS.TabularActionsAnnotation annotation = GetAnnotation(cube); bool bContainsPerspectiveListAnnotation = false; foreach (Microsoft.AnalysisServices.Action action in cube.Actions) { SSAS.TabularAction actionAnnotation = annotation.Find(action.ID); if (actionAnnotation == null) { continue; } //see if this action is assigned to perspectives if (actionAnnotation.Perspectives != null && actionAnnotation.Perspectives.Length > 0) { bContainsPerspectiveListAnnotation = true; } } long lngPerspectiveActionsCount = 0; foreach (Perspective p in cube.Perspectives) { lngPerspectiveActionsCount += p.Actions.Count; } //note: this logic is also duplicated in the constructor of TabularActionsEditorForm since we will just rely on it to fix the actions if (bContainsPerspectiveListAnnotation && lngPerspectiveActionsCount == 0 && cube.Perspectives.Count > 0) { return("Click OK for BIDS Helper to restore the assignments of actions to perspectives. The Tabular Actions Editor form will open. Then click Yes then OK."); } else { return(null); } }
public string GetPreBuildWarning(Microsoft.AnalysisServices.BackEnd.DataModelingSandbox sandbox) { string sLevelsWithProblems = string.Empty; foreach (Level l in GetProblemLevels(sandbox)) { if (sLevelsWithProblems.Length > 0) { sLevelsWithProblems += ", "; } sLevelsWithProblems += "[" + l.ParentDimension.Name + "].[" + l.Parent.Name + "].[" + l.Name + "]"; } if (sLevelsWithProblems.Length == 0) { return(null); } else { return("Click OK for BIDS Helper to restore the HideMemberIf settings on the following levels: " + sLevelsWithProblems); } }
public override DiagramActionResult Do(IDiagramActionInstance actionInstance) { try { Microsoft.AnalysisServices.BackEnd.DataModelingSandbox sandbox = TabularHelpers.GetTabularSandboxFromActiveWindow(); if (sandbox == null) { throw new Exception("Can't get Sandbox!"); } IServiceProvider provider = TabularHelpers.GetTabularServiceProviderFromActiveWindow(); foreach (IDiagramNode node in actionInstance.Targets.OfType <IDiagramNode>()) { _plugin.ExecuteSyncDescriptions(sandbox, provider, node.Text); } } catch (System.Exception ex) { MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace, "BIDS Helper - Error"); } return(new DiagramActionResult(null, (IDiagramObject)null)); }
private void ExecSandbox(Microsoft.AnalysisServices.BackEnd.DataModelingSandbox sandboxParam) { try { sandbox = sandboxParam; if (sandbox == null) throw new Exception("Can't get Sandbox!"); cube = sandbox.Cube; if (cube == null) throw new Exception("The workspace database cube doesn't exist."); SSAS.TabularActionsEditorForm form = new SSAS.TabularActionsEditorForm(cube, sandbox.AdomdConnection); if (form.ShowDialog() == DialogResult.OK) { Microsoft.AnalysisServices.BackEnd.DataModelingSandbox.AMOCode code = delegate { using (Microsoft.AnalysisServices.BackEnd.SandboxTransaction tran = sandbox.CreateTransaction()) { foreach (Perspective p in cube.Perspectives) { p.Actions.Clear(); } cube.Actions.Clear(); foreach (Microsoft.AnalysisServices.Action action in form.Actions()) { cube.Actions.Add(action); foreach (Perspective p in cube.Perspectives) { if (form.ActionInPerspective(action.ID, p.ID)) { p.Actions.Add(action.ID); } } } TabularHelpers.SaveXmlAnnotation(cube, SSAS.TabularActionsEditorForm.ACTION_ANNOTATION, form.Annotation); cube.Update(UpdateOptions.ExpandFull); tran.Commit(); } }; sandbox.ExecuteAMOCode(Microsoft.AnalysisServices.BackEnd.DataModelingSandbox.OperationType.Update, Microsoft.AnalysisServices.BackEnd.DataModelingSandbox.OperationCancellability.AlwaysExecute, code, true); } } catch (System.Exception ex) { MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace, "BIDS Helper - Error"); } }
internal void SetHideMemberIf(Microsoft.AnalysisServices.BackEnd.DataModelingSandbox sandboxParam, IEnumerable <Tuple <string, string, string> > hierarchyLevels, List <HideIfValue> newValues) { try { #if DENALI || SQL2014 Microsoft.AnalysisServices.BackEnd.DataModelingSandbox.AMOCode code; var sandbox = sandboxParam; #else Microsoft.AnalysisServices.BackEnd.AMOCode code; var sandbox = (Microsoft.AnalysisServices.BackEnd.DataModelingSandboxAmo)sandboxParam.Impl; #endif code = delegate { Microsoft.AnalysisServices.BackEnd.SandboxTransactionProperties properties = new Microsoft.AnalysisServices.BackEnd.SandboxTransactionProperties(); properties.RecalcBehavior = Microsoft.AnalysisServices.BackEnd.TransactionRecalcBehavior.AlwaysRecalc; List <Dimension> dims = new List <Dimension>(); using (Microsoft.AnalysisServices.BackEnd.SandboxTransaction tran = sandboxParam.CreateTransaction(properties)) { if (!TabularHelpers.EnsureDataSourceCredentials(sandboxParam)) { MessageBox.Show("Cancelling apply of HideMemberIf because data source credentials were not entered.", "BIDS Helper Tabular HideMemberIf - Cancelled!"); tran.RollbackAndContinue(); return; } SSAS.TabularHideMemberIfAnnotation annotation = GetAnnotation(sandboxParam); foreach (Tuple <string, string, string> tuple in hierarchyLevels) { Dimension d = sandbox.Database.Dimensions.GetByName(tuple.Item1); if (!dims.Contains(d)) { dims.Add(d); } Hierarchy h = d.Hierarchies.GetByName(tuple.Item2); Level l = h.Levels.GetByName(tuple.Item3); l.HideMemberIf = newValues[0]; newValues.RemoveAt(0); annotation.Set(l); } TabularHelpers.SaveXmlAnnotation(sandbox.Database, HIDEMEMBERIF_ANNOTATION, annotation); sandbox.Database.Update(UpdateOptions.ExpandFull); //bug in AS2012 (still not working in RTM CU1) requires ProcessFull to successfully switch from HideMemberIf=Never to NoName foreach (Dimension d in dims) { d.Process(ProcessType.ProcessFull); } tran.GetType().InvokeMember("Commit", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.InvokeMethod | System.Reflection.BindingFlags.Public, null, tran, null); //The .Commit() function used to return a list of strings, but in the latest set of code it is a void method which leads to "method not found" errors //tran.Commit(); } }; #if DENALI || SQL2014 sandbox.ExecuteAMOCode(Microsoft.AnalysisServices.BackEnd.DataModelingSandbox.OperationType.Update, Microsoft.AnalysisServices.BackEnd.DataModelingSandbox.OperationCancellability.AlwaysExecute, code, true); #else sandboxParam.ExecuteEngineCode(Microsoft.AnalysisServices.BackEnd.DataModelingSandbox.OperationType.Update, Microsoft.AnalysisServices.BackEnd.DataModelingSandbox.OperationCancellability.AlwaysExecute, code, true); #endif } catch (System.Exception ex) { MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace, "BIDS Helper - Error"); } }
public DataModelingSandboxWrapper(Microsoft.AnalysisServices.BackEnd.DataModelingSandbox sandbox) { _sandbox = sandbox; }
private void ExecSandbox(Microsoft.AnalysisServices.BackEnd.DataModelingSandbox sandboxParam) { try { sandbox = sandboxParam; if (sandbox == null) throw new Exception("Can't get Sandbox!"); cube = sandbox.Cube; if (cube == null) throw new Exception("The workspace database cube doesn't exist."); bool bRestoreDisplayFolders = false; SSAS.TabularDisplayFoldersAnnotation annotationSaved = GetAnnotation(sandbox); if (GetPreBuildWarning(sandbox) != null) { if (MessageBox.Show("Some display folders have been blanked out by other editing operations. Restoring display folders may be possible except when a measures or columns have been renamed.\r\n\r\nWould you like BIDS Helper to attempt restore the display folders now?", "BIDS Helper Tabular Display Folders", MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes) { bRestoreDisplayFolders = true; } } SSAS.TabularDisplayFolderWindow form = new SSAS.TabularDisplayFolderWindow(); List<BIDSHelper.SSAS.TabularDisplayFolder> displayFolders = new List<BIDSHelper.SSAS.TabularDisplayFolder>(); Microsoft.AnalysisServices.AdomdClient.AdomdRestrictionCollection restrictions = new Microsoft.AnalysisServices.AdomdClient.AdomdRestrictionCollection(); restrictions.Add(new Microsoft.AnalysisServices.AdomdClient.AdomdRestriction("CUBE_NAME", cube.Name)); DataSet datasetMeasures = sandbox.AdomdConnection.GetSchemaDataSet("MDSCHEMA_MEASURES", restrictions); Database db = cube.Parent; foreach (Dimension d in db.Dimensions) { foreach (DimensionAttribute da in d.Attributes) { if (da.Type != AttributeType.RowNumber && da.AttributeHierarchyVisible) { if (bRestoreDisplayFolders && string.IsNullOrEmpty(da.AttributeHierarchyDisplayFolder)) { SSAS.TabularDisplayFolderAnnotation a = annotationSaved.Find(da); if (a != null) da.AttributeHierarchyDisplayFolder = a.DisplayFolder; } displayFolders.Add(new BIDSHelper.SSAS.TabularDisplayFolder(d.Name, da)); } } foreach (Hierarchy h in d.Hierarchies) { if (bRestoreDisplayFolders && string.IsNullOrEmpty(h.DisplayFolder)) { SSAS.TabularDisplayFolderAnnotation a = annotationSaved.Find(h); if (a != null) h.DisplayFolder = a.DisplayFolder; } displayFolders.Add(new BIDSHelper.SSAS.TabularDisplayFolder(d.Name, h)); } } foreach (Cube c in db.Cubes) { foreach (MdxScript mdx in c.MdxScripts) { foreach (CalculationProperty calc in mdx.CalculationProperties) { if (calc.Visible && !calc.CalculationReference.StartsWith("KPIs.")) //TODO: display folder for KPIs have to be set inline in MDX script... do this in the future { string sTableName = null; foreach (DataRow r in datasetMeasures.Tables[0].Rows) { if (Convert.ToString(r["MEASURE_UNIQUE_NAME"]) == "[Measures]." + calc.CalculationReference) { sTableName = Convert.ToString(r["MEASUREGROUP_NAME"]); break; } } if (bRestoreDisplayFolders && string.IsNullOrEmpty(calc.DisplayFolder)) { SSAS.TabularDisplayFolderAnnotation a = annotationSaved.Find(calc); if (a != null) calc.DisplayFolder = a.DisplayFolder; } displayFolders.Add(new BIDSHelper.SSAS.TabularDisplayFolder(sTableName, calc)); } } } } displayFolders.Sort(); form.dataGrid1.ItemsSource = displayFolders; if (form.ShowDialog() == true) { //count dirty changes and create annotation SSAS.TabularDisplayFoldersAnnotation annotation = new SSAS.TabularDisplayFoldersAnnotation(); List<SSAS.TabularDisplayFolderAnnotation> folderAnnotationsList = new List<SSAS.TabularDisplayFolderAnnotation>(); int iNumberOfChanges = 0; foreach (BIDSHelper.SSAS.TabularDisplayFolder folder in displayFolders) { if (folder.Dirty) { iNumberOfChanges++; } if (!string.IsNullOrEmpty(folder.DisplayFolder)) { SSAS.TabularDisplayFolderAnnotation folderAnnotation = new SSAS.TabularDisplayFolderAnnotation(); folderAnnotation.TableID = cube.Parent.Dimensions.GetByName(folder.Table).ID; folderAnnotation.ObjectID = folder.ObjectID; folderAnnotation.ObjectType = folder.ObjectType; folderAnnotation.DisplayFolder = folder.DisplayFolder; folderAnnotationsList.Add(folderAnnotation); } } annotation.TabularDisplayFolders = folderAnnotationsList.ToArray(); if (iNumberOfChanges > 0 || bRestoreDisplayFolders) { Microsoft.AnalysisServices.BackEnd.DataModelingSandbox.AMOCode code = delegate { using (Microsoft.AnalysisServices.BackEnd.SandboxTransaction tran = sandbox.CreateTransaction()) { foreach (BIDSHelper.SSAS.TabularDisplayFolder folder in displayFolders) { folder.SaveDisplayFolder(); } TabularHelpers.SaveXmlAnnotation(cube.Parent, DISPLAY_FOLDER_ANNOTATION, annotation); TabularHelpers.EnsureDataSourceCredentials(sandbox); cube.Parent.Update(UpdateOptions.ExpandFull); tran.Commit(); } }; sandbox.ExecuteAMOCode(Microsoft.AnalysisServices.BackEnd.DataModelingSandbox.OperationType.Update, Microsoft.AnalysisServices.BackEnd.DataModelingSandbox.OperationCancellability.AlwaysExecute, code, true); } } } catch (System.Exception ex) { MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace, "BIDS Helper - Error"); } }
public void FixPreBuildWarning(Microsoft.AnalysisServices.BackEnd.DataModelingSandbox sandbox) { //never gets called }
public DataModelingSandboxWrapper(BIDSHelperPluginBase plugin) { _sandbox = TabularHelpers.GetTabularSandboxFromBimFile(plugin, true); }
public override void Exec() { try { UIHierarchy solExplorer = this.ApplicationObject.ToolWindows.SolutionExplorer; UIHierarchyItem hierItem = ((UIHierarchyItem)((System.Array)solExplorer.SelectedItems).GetValue(0)); sandbox = TabularHelpers.GetTabularSandboxFromBimFile(hierItem, true); if (sandbox == null) throw new Exception("Can't get Sandbox!"); ExecInternal(false); } catch (System.Exception ex) { MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace, "BIDS Helper - Error"); } }
public string GetPreBuildWarning(Microsoft.AnalysisServices.BackEnd.DataModelingSandbox sandbox) { this.sandbox = sandbox; ExecInternal(true); return(null); //always return null since ExecInternal just handled it }
public void RunCustomDesignRules(Database db, Microsoft.AnalysisServices.BackEnd.DataModelingSandbox sandbox) { UIHierarchy solExplorer = this.ApplicationObject.ToolWindows.SolutionExplorer; if (((System.Array)solExplorer.SelectedItems).Length != 1) { return; } //UIHierarchyItem hierItem = ((UIHierarchyItem)((System.Array)solExplorer.SelectedItems).GetValue(0)); // TODO - get database properties //ProjectItem pi = (ProjectItem)hierItem.Object; //Window w = pi.Open(BIDSViewKinds.Designer); //opens the designer //w.Activate(); try { //ClearTaskList(); ClearErrorList(); ApplicationObject.StatusBar.Text = "Starting Powershell Design Rules Engine..."; var ps = PowerShell.Create(); string modelType; if (db == null) { modelType = "Tabular"; ps.Runspace.SessionStateProxy.SetVariable("WorkspaceConnection", sandbox.AdomdConnection); ps.Runspace.SessionStateProxy.SetVariable("CurrentCube", sandbox.Cube); } else { modelType = "MultiDim"; ps.Runspace.SessionStateProxy.SetVariable("CurrentDB", db); } ps.Runspace.SessionStateProxy.SetVariable("ModelType", modelType); ps.Runspace.SessionStateProxy.SetVariable("VerbosePreference", "Continue"); ps.Streams.Debug.DataAdded += new EventHandler <DataAddedEventArgs>(Debug_DataAdded); ps.Streams.Warning.DataAdded += new EventHandler <DataAddedEventArgs>(Warning_DataAdded); ps.Streams.Error.DataAdded += new EventHandler <DataAddedEventArgs>(Error_DataAdded); ps.Streams.Verbose.DataAdded += new EventHandler <DataAddedEventArgs>(Verbose_DataAdded); ApplicationObject.StatusBar.Text = "Loading Custom Design Rules..."; // TODO - look into adding a script to allow calling a copy from a central rule repository string dllFile = (new System.Uri(System.Reflection.Assembly.GetExecutingAssembly().CodeBase)).AbsolutePath; System.Diagnostics.Debug.WriteLine(dllFile); FileInfo dll = new FileInfo(dllFile); DirectoryInfo scripts = new DirectoryInfo(dll.Directory.FullName + "\\SSAS_Design_Rules"); foreach (FileInfo f in scripts.GetFiles(modelType + "_*.ps1")) { TextReader tr = new StreamReader(f.OpenRead()); string psScript = tr.ReadToEnd(); ps.Commands.Clear(); ps.AddScript(psScript); ps.Invoke(); } ps.Commands.Clear(); // get a list of functions var pipeline = ps.Runspace.CreatePipeline(); var cmd1 = new System.Management.Automation.Runspaces.Command("get-childitem"); cmd1.Parameters.Add("Path", @"function:\Check*"); pipeline.Commands.Add(cmd1); var cmd2 = new System.Management.Automation.Runspaces.Command("where-object"); var sb = ScriptBlock.Create("$_.Parameters.Count -eq 0"); cmd2.Parameters.Add("FilterScript", sb); pipeline.Commands.Add(cmd2); var funcs = pipeline.Invoke(); var funcList = new List <string>(); foreach (var f in funcs) { funcList.Add(f.ToString()); } ps.Commands.Clear(); ApplicationObject.StatusBar.Text = ""; // show dialog var dialog = new CustomDesignRulesCheckerForm(); dialog.Functions = funcList; dialog.Plugin = this; if (dialog.ShowDialog() == DialogResult.OK) { var iCnt = 0; // run selected functions foreach (var f in dialog.Functions) { ApplicationObject.StatusBar.Progress(true, string.Format("Running rule '{0}'", f), iCnt, dialog.Functions.Count); ps.AddCommand(f); ps.Invoke(); iCnt++; } ApplicationObject.StatusBar.Progress(false); } } catch (System.Exception ex) { AddTaskItem(PriorityType.Error, "ERROR RUNNING DESIGN CHECKS: " + ex.Message); } }
public string GetPreBuildWarning(Microsoft.AnalysisServices.BackEnd.DataModelingSandbox sandbox) { this.sandbox = sandbox; ExecInternal(true); return null; //always return null since ExecInternal just handled it }
internal void ExecuteSyncDescriptions(Microsoft.AnalysisServices.BackEnd.DataModelingSandbox sandbox, IServiceProvider provider, string tableName) { try { #if DENALI || SQL2014 var db = sandbox.Database; Microsoft.AnalysisServices.BackEnd.DataModelingSandbox.AMOCode code; #else Database db = null; if (!sandbox.IsTabularMetadata) { db = ((Microsoft.AnalysisServices.BackEnd.DataModelingSandboxAmo)sandbox.Impl).Database; } else { db = null; } Microsoft.AnalysisServices.BackEnd.AMOCode code; #endif code = delegate { int iDescriptionsSet; Microsoft.AnalysisServices.BackEnd.SandboxTransactionProperties properties = new Microsoft.AnalysisServices.BackEnd.SandboxTransactionProperties(); properties.RecalcBehavior = Microsoft.AnalysisServices.BackEnd.TransactionRecalcBehavior.Default; using (Microsoft.AnalysisServices.BackEnd.SandboxTransaction tran = sandbox.CreateTransaction(properties)) { if (!TabularHelpers.EnsureDataSourceCredentials(sandbox)) { MessageBox.Show("Cancelling Sync Descriptions because data source credentials were not entered.", "BIDS Helper Tabular Sync Descriptions - Cancelled!"); tran.RollbackAndContinue(); return; } #if !(DENALI || SQL2014) Microsoft.AnalysisServices.BackEnd.DataModelingTable table = sandbox.Tables[tableName]; if (table.IsStructuredDataSource) { MessageBox.Show("BI Developer Extensions does not yet support modern (Power Query) data sources.", "BI Developer Extensions"); return; } iDescriptionsSet = SyncDescriptionsPlugin.SyncDescriptions(table, true); if (iDescriptionsSet > 0) { table.UpdateNowOrLater(); } #else Dimension d = db.Dimensions.GetByName(tableName); iDescriptionsSet = SyncDescriptionsPlugin.SyncDescriptions(d, true, provider, true); if (iDescriptionsSet > 0) { db.Update(UpdateOptions.ExpandFull); } #endif tran.GetType().InvokeMember("Commit", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.InvokeMethod | System.Reflection.BindingFlags.Public, null, tran, null); //The .Commit() function used to return a list of strings, but in the latest set of code it is a void method which leads to "method not found" errors //tran.Commit(); } MessageBox.Show("Set " + iDescriptionsSet + " descriptions successfully.", "BIDS Helper - Sync Descriptions"); }; #if DENALI || SQL2014 sandbox.ExecuteAMOCode(Microsoft.AnalysisServices.BackEnd.DataModelingSandbox.OperationType.Update, Microsoft.AnalysisServices.BackEnd.DataModelingSandbox.OperationCancellability.AlwaysExecute, code, true); #else sandbox.ExecuteEngineCode(Microsoft.AnalysisServices.BackEnd.DataModelingSandbox.OperationType.Update, Microsoft.AnalysisServices.BackEnd.DataModelingSandbox.OperationCancellability.AlwaysExecute, code, true); #endif } catch (System.Exception ex) { MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace, "BIDS Helper - Error"); } }
internal override void OnUpdateConfigBegin(IVsHierarchy pHierProj, VSSOLNBUILDUPDATEFLAGS dwAction, ref int pfCancel) { if (!this.Enabled) { return; } if (dwAction == VSSOLNBUILDUPDATEFLAGS.SBF_OPERATION_CLEAN) { return; } foreach (UIHierarchyItem hierItem in VisualStudioHelpers.GetAllItemsFromSolutionExplorer(this.ApplicationObject.ToolWindows.SolutionExplorer)) { if (hierItem.Name != null && hierItem.Name.ToLower().EndsWith(".bim")) { Microsoft.AnalysisServices.BackEnd.DataModelingSandbox sandbox = TabularHelpers.GetTabularSandboxFromBimFile(this, false); if (sandbox == null) { var sandboxEditor = TabularHelpers.GetTabularSandboxEditorFromBimFile(hierItem, true); if (sandboxEditor != null) { sandbox = sandboxEditor.Sandbox; } } if (sandbox != null) { #if !DENALI && !SQL2014 if (sandbox.IsTabularMetadata) { return; } #endif List <BIDSHelperPluginBase> checks = new List <BIDSHelperPluginBase>(); foreach (BIDSHelperPluginBase plugin in BIDSHelperPackage.Plugins.Values) { Type t = plugin.GetType(); if (plugin is ITabularOnPreBuildAnnotationCheck && !t.IsInterface && !t.IsAbstract) { ITabularOnPreBuildAnnotationCheck check = (ITabularOnPreBuildAnnotationCheck)plugin; if (check.TabularOnPreBuildAnnotationCheckPriority == TabularOnPreBuildAnnotationCheckPriority.HighPriority) { checks.Insert(0, plugin); //insert the high priority checks at the front of the list so they get run first } else { checks.Add(plugin); } } } foreach (BIDSHelperPluginBase plugin in checks) { ITabularOnPreBuildAnnotationCheck check = (ITabularOnPreBuildAnnotationCheck)plugin; string sWarning = check.GetPreBuildWarning(sandbox); if (sWarning != null) { if (MessageBox.Show(sWarning, "BIDS Helper Pre-Build Warning - " + plugin.FeatureName, MessageBoxButtons.OKCancel) == DialogResult.OK) { Microsoft.VisualStudio.Project.Automation.OAFileItem project = hierItem.Object as Microsoft.VisualStudio.Project.Automation.OAFileItem; Window win = project.Open(EnvDTE.Constants.vsViewKindPrimary); win.Activate(); check.FixPreBuildWarning(sandbox); project.Save(hierItem.Name); } } } } } } }
public override ViewModelActionResult Do(IViewModelActionInstance actionInstance) #endif { try { #if DENALI || SQL2014 IEnumerable <Tuple <string, string, string> > hierarchyLevels = this.SortHierarchyLevels(actionInstance.Targets.OfType <IDiagramNode>()); #else IEnumerable <Tuple <string, string, string> > hierarchyLevels = this.SortHierarchyLevels(actionInstance.Targets.OfType <IViewModelNode>()); #endif Microsoft.AnalysisServices.BackEnd.DataModelingSandbox sandbox = TabularHelpers.GetTabularSandboxFromActiveWindow(_plugin.package); if (sandbox == null) { throw new Exception("Can't get Sandbox!"); } string sWarning = _plugin.GetPreBuildWarning(sandbox); if (sWarning != null) { if (MessageBox.Show(sWarning, "BIDS Helper Tabular HideMemberIf", MessageBoxButtons.OKCancel) == DialogResult.OK) { _plugin.FixPreBuildWarning(sandbox); } } Microsoft.AnalysisServices.HideIfValue currentValue = _plugin.GetHideMemberIf(hierarchyLevels); form = new Form(); form.Icon = BIDSHelper.Resources.Common.BIDSHelper; form.Text = "BIDS Helper Tabular HideMemberIf Editor"; form.MaximizeBox = true; form.MinimizeBox = false; form.Width = 400; form.Height = 150; form.SizeGripStyle = SizeGripStyle.Hide; form.MinimumSize = new System.Drawing.Size(form.Width, form.Height); Label labelAnnotation = new Label(); labelAnnotation.Text = "HideMemberIf:"; labelAnnotation.Top = 25; labelAnnotation.Left = 5; labelAnnotation.Width = 80; labelAnnotation.Anchor = AnchorStyles.Left | AnchorStyles.Top; labelAnnotation.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; form.Controls.Add(labelAnnotation); ComboBox combo = new ComboBox(); combo.DropDownStyle = ComboBoxStyle.DropDownList; combo.Width = form.Width - 40 - labelAnnotation.Width; combo.Left = labelAnnotation.Right + 5; combo.Top = 25; combo.Anchor = AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top; form.Controls.Add(combo); combo.Items.AddRange(Enum.GetNames(typeof(HideIfValue))); combo.SelectedIndex = combo.Items.IndexOf(currentValue.ToString()); labelAnnotation = new Label(); labelAnnotation.Text = "BIDS Helper will ProcessFull this table when you click OK."; labelAnnotation.Top = combo.Bottom + 10; labelAnnotation.Left = 5; labelAnnotation.Width = form.Width; labelAnnotation.Anchor = AnchorStyles.Left | AnchorStyles.Top; labelAnnotation.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; form.Controls.Add(labelAnnotation); Button okButton = new Button(); okButton.Text = "OK"; okButton.Anchor = AnchorStyles.Right | AnchorStyles.Bottom; okButton.Left = form.Right - okButton.Width * 2 - 40; okButton.Top = form.Bottom - okButton.Height * 2 - 20; okButton.Click += new EventHandler(okButton_Click); form.Controls.Add(okButton); form.AcceptButton = okButton; Button cancelButton = new Button(); cancelButton.Text = "Cancel"; cancelButton.Anchor = AnchorStyles.Right | AnchorStyles.Bottom; cancelButton.Left = okButton.Right + 10; cancelButton.Top = okButton.Top; form.CancelButton = cancelButton; form.Controls.Add(cancelButton); DialogResult result = form.ShowDialog(); if (result == DialogResult.OK) { //build a list of HideIfValue enums the same length as the list of levels HideIfValue val = (HideIfValue)Enum.Parse(typeof(HideIfValue), combo.SelectedItem.ToString()); List <HideIfValue> vals = new List <HideIfValue>(); foreach (Tuple <string, string, string> level in hierarchyLevels) { vals.Add(val); } //set the value _plugin.SetHideMemberIf(sandbox, hierarchyLevels, vals); } } catch (System.Exception ex) { MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace, "BIDS Helper - Error"); } #if DENALI || SQL2014 return(new DiagramActionResult(null, (IDiagramObject)null)); #else return(new ViewModelActionResult(null, (IViewModelObject)null)); #endif }