コード例 #1
0
 public HierarchyLevelCollection(Hierarchy hierarchy) : base()
 {
     Hierarchy = hierarchy;
 }
コード例 #2
0
ファイル: CubeDef.cs プロジェクト: analyzer2004/Bagle-BI
        public QueryContext Prepare()
        {
            if (!IsReady)
            {
                throw new CubeNotReadyException(this);
            }

            DataSource    ds = GetDataSource();
            IDbConnection cn = ds.GetConnection();

            try
            {
                Cube cube = Runtime.Cubes[Name];
                if (cube == null)
                {
                    cube = new Cube(Name);
                    Runtime.Cubes.Add(cube);
                }

                foreach (MeasureDef md in Measures)
                {
                    if (cube.Measures[md.Name] == null)
                    {
                        Measure m = new Measure(md, md.Name);
                        cube.Measures.Add(m);
                    }
                }


                cn.Open();
                Dimensions.ForEach(cdd =>
                {
                    //cdd: CubeDimensionDef
                    //ad: AttributeDef
                    Dimension dim = Runtime.Dimensions[cdd.Name];
                    if (dim == null)
                    {
                        dim = new Dimension(cdd.Name);
                        Runtime.Dimensions.Add(dim);
                        cube.Dimensions.Add(dim);
                    }

                    cdd.Dimension.Attributes.ForEach(ad =>
                    {
                        Attribute attr = dim.Attributes[ad.Name];
                        if (attr == null)
                        {
                            attr = new Attribute(ad, ad.Name);
                            dim.Attributes.Add(attr);

                            AttributeQuery aq = new AttributeQuery(attr, cn);
                            aq.QueryMembers();
                        }
                    });

                    cdd.Dimension.Hierarchies.ForEach(ah =>
                    {
                        Hierarchy hier = dim.Hierarchies[ah.Name];
                        if (hier == null)
                        {
                            hier = new Hierarchy(ah, ah.Name);
                            dim.Hierarchies.Add(hier);

                            HierarchyQuery hq = new HierarchyQuery(hier, cn);
                            hq.QueryMembers();
                        }
                    });
                });

                return(new QueryContext(cube, cn));
            }
            catch (Exception e)
            {
                CloseConnection(cn);
                throw e;
            }
        }
コード例 #3
0
 public HierarchyQuery(Hierarchy hierarchy, IDbConnection cn) : base(cn)
 {
     Hierarchy = hierarchy;
 }