当前位置: 首页>>代码示例>>C#>>正文


C# Cube.Update方法代码示例

本文整理汇总了C#中Cube.Update方法的典型用法代码示例。如果您正苦于以下问题:C# Cube.Update方法的具体用法?C# Cube.Update怎么用?C# Cube.Update使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Cube的用法示例。


在下文中一共展示了Cube.Update方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CreateInternetSalesMeasureGroup


//.........这里部分代码省略.........
            //meas.AggregateFunction = AggregationFunction.Sum;
            //meas.MeasureExpression = "[Internet Total Product Cost] * [Average Rate]";
            //meas.FormatString = "Currency";
            //meas.Source = CreateDataItem(db.DataSourceViews[0], "FactInternetSales", "TotalProductCost");

            meas = mg.Measures.Add("Internet Order Count");
            meas.AggregateFunction = AggregationFunction.Count;
            meas.FormatString = "#,#";
            meas.Source = CreateDataItem(db.DataSourceViews[0], "FactInternetSales", "ProductKey");

            #endregion

            #region Create measure group dimensions

            CubeDimension cubeDim;
            RegularMeasureGroupDimension regMgDim;
            ManyToManyMeasureGroupDimension mmMgDim;
            MeasureGroupAttribute mgAttr;

            //cubeDim = cube.Dimensions.GetByName("Date");
            //regMgDim = new RegularMeasureGroupDimension(cubeDim.ID);
            //mg.Dimensions.Add(regMgDim);
            //mgAttr = regMgDim.Attributes.Add(cubeDim.Dimension.Attributes.GetByName("Date").ID);
            //mgAttr.Type = MeasureGroupAttributeType.Granularity;
            //mgAttr.KeyColumns.Add(CreateDataItem(db.DataSourceViews[0], "FactInternetSales", "OrderDateKey"));

            //cubeDim = cube.Dimensions.GetByName("Ship Date");
            //regMgDim = new RegularMeasureGroupDimension(cubeDim.ID);
            //mg.Dimensions.Add(regMgDim);
            //mgAttr = regMgDim.Attributes.Add(cubeDim.Dimension.Attributes.GetByName("Date").ID);
            //mgAttr.Type = MeasureGroupAttributeType.Granularity;
            //mgAttr.KeyColumns.Add(CreateDataItem(db.DataSourceViews[0], "FactInternetSales", "ShipDateKey"));

            //cubeDim = cube.Dimensions.GetByName("Delivery Date");
            //regMgDim = new RegularMeasureGroupDimension(cubeDim.ID);
            //mg.Dimensions.Add(regMgDim);
            //mgAttr = regMgDim.Attributes.Add(cubeDim.Dimension.Attributes.GetByName("Date").ID);
            //mgAttr.Type = MeasureGroupAttributeType.Granularity;
            //mgAttr.KeyColumns.Add(CreateDataItem(db.DataSourceViews[0], "FactInternetSales", "DueDateKey"));

            cubeDim = cube.Dimensions.GetByName("Customer");
            regMgDim = new RegularMeasureGroupDimension(cubeDim.ID);
            mg.Dimensions.Add(regMgDim);
            mgAttr = regMgDim.Attributes.Add(cubeDim.Dimension.Attributes.GetByName("Full Name").ID);
            mgAttr.Type = MeasureGroupAttributeType.Granularity;
            mgAttr.KeyColumns.Add(CreateDataItem(db.DataSourceViews[0], "FactInternetSales", "CustomerKey"));

            //cubeDim = cube.Dimensions.GetByName("Product");
            //regMgDim = new RegularMeasureGroupDimension(cubeDim.ID);
            //mg.Dimensions.Add(regMgDim);
            //mgAttr = regMgDim.Attributes.Add(cubeDim.Dimension.Attributes.GetByName("Product Name").ID);
            //mgAttr.Type = MeasureGroupAttributeType.Granularity;
            //mgAttr.KeyColumns.Add(CreateDataItem(db.DataSourceViews[0], "FactInternetSales", "ProductKey"));

            //cubeDim = cube.Dimensions.GetByName("Source Currency");
            //regMgDim = new RegularMeasureGroupDimension(cubeDim.ID);
            //mg.Dimensions.Add(regMgDim);
            //mgAttr = regMgDim.Attributes.Add(cubeDim.Dimension.Attributes.GetByName("Currency").ID);
            //mgAttr.Type = MeasureGroupAttributeType.Granularity;
            //mgAttr.KeyColumns.Add(CreateDataItem(db.DataSourceViews[0], "FactInternetSales", "CurrencyKey"));

            //cubeDim = cube.Dimensions.GetByName("Sales Reason");
            //mmMgDim = new ManyToManyMeasureGroupDimension();
            //mmMgDim.CubeDimensionID = cubeDim.ID;
            //mmMgDim.MeasureGroupID = cube.MeasureGroups.GetByName("Sales Reasons").ID;
            //mg.Dimensions.Add(mmMgDim);

            //cubeDim = cube.Dimensions.GetByName("Internet Sales Order Details");
            //regMgDim = new RegularMeasureGroupDimension(cubeDim.ID);
            //mg.Dimensions.Add(regMgDim);
            //mgAttr = regMgDim.Attributes.Add(cubeDim.Dimension.Attributes.GetByName("Sales Order Key").ID);
            //mgAttr.Type = MeasureGroupAttributeType.Granularity;
            //mgAttr.KeyColumns.Add(CreateDataItem(db.DataSourceViews[0], "FactInternetSales", "SalesOrderNumber"));
            //mgAttr.KeyColumns.Add(CreateDataItem(db.DataSourceViews[0], "FactInternetSales", "SalesOrderLineNumber"));

            #endregion

            #region Create partitions

            Partition part;

            part = mg.Partitions.Add("Internet_Sales_184");
            part.StorageMode = StorageMode.Molap;
            part.Source = new QueryBinding(db.DataSources[0].ID, "SELECT * FROM [dbo].[FactInternetSales] WHERE OrderDateKey <= '184'");
            part.Annotations.Add("LastOrderDateKey", "184");

            part = mg.Partitions.Add("Internet_Sales_549");
            part.StorageMode = StorageMode.Molap;
            part.Source = new QueryBinding(db.DataSources[0].ID, "SELECT * FROM [dbo].[FactInternetSales] WHERE OrderDateKey > '184' AND OrderDateKey <= '549'");
            part.Annotations.Add("LastOrderDateKey", "549");

            part = mg.Partitions.Add("Internet_Sales_914");
            part.StorageMode = StorageMode.Molap;
            part.Source = new QueryBinding(db.DataSources[0].ID, "SELECT * FROM [dbo].[FactInternetSales] WHERE OrderDateKey > '549' AND OrderDateKey <= '914'");
            part.Annotations.Add("LastOrderDateKey", "914");

            #endregion

            cube.Update(UpdateOptions.ExpandFull);
        }
开发者ID:piaolingzxh,项目名称:Justin,代码行数:101,代码来源:OlapDemo.cs

示例2: ExecSandbox

        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");
            }
        }
开发者ID:japj,项目名称:bidshelper,代码行数:47,代码来源:TabularActionsEditorPlugin.cs


注:本文中的Cube.Update方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。