Exemplo n.º 1
0
        public void TestADOTabularCSDLVisitor()
        {
            ADOTabularConnection c = new ADOTabularConnection("Data Source=localhost", AdomdType.AnalysisServices);
            MetaDataVisitorCSDL v = new MetaDataVisitorCSDL(c);
            ADOTabularModel m = new ADOTabularModel(c, "Test","Test", "Test Description", "");
            System.Xml.XmlReader xr = new System.Xml.XmlTextReader(@"..\..\data\csdl.xml");
            var tabs = new ADOTabularTableCollection(c,m);

            v.GenerateTablesFromXmlReader(tabs, xr);

            Assert.AreEqual(4, tabs.Count);
            Assert.AreEqual(8, tabs["Sales"].Columns.Count());
        }
        private static void PopulateDAXFunctionsFromXml(ADOTabularModel model, XmlReader rdr)
        {
            while (!(rdr.NodeType == XmlNodeType.EndElement &&
                     rdr.LocalName == "DAXFunctions"))
            {
                if (rdr.NodeType == XmlNodeType.Element && rdr.LocalName == "SummarizeColumns")
                {
                    var enabled = rdr.ReadElementContentAsBoolean();
                    model.Capabilities.DAXFunctions.SummarizeColumns = enabled;
                }

                rdr.Read();
            }
        }
Exemplo n.º 3
0
 /* public ADOTabularTable(ADOTabularConnection adoTabConn, DataRow dr, ADOTabularModel model)
  * {
  *   Caption = dr["DIMENSION_NAME"].ToString();
  *   IsVisible = bool.Parse(dr["DIMENSION_IS_VISIBLE"].ToString());
  *   Description = dr["DESCRIPTION"].ToString();
  *   _adoTabConn = adoTabConn;
  *   _model = model;
  * }
  */
 public ADOTabularTable(IADOTabularConnection adoTabConn, ADOTabularModel model, string internalReference, string name, string caption, string description, bool isVisible, bool isPrivate, bool showAsVariationsOnly)
 {
     _adoTabConn       = adoTabConn;
     InternalReference = internalReference;
     Name                 = name ?? internalReference;
     Caption              = caption ?? name ?? internalReference;
     DaxName              = GetDaxName();
     Description          = description;
     IsVisible            = isVisible;
     Relationships        = new List <ADOTabularRelationship>();
     FolderItems          = new List <IADOTabularObjectReference>();
     Private              = isPrivate;
     ShowAsVariationsOnly = showAsVariationsOnly;
     Model                = model;
 }
Exemplo n.º 4
0
        public void TestADOTabularCSDLVisitorHierarchies()
        {
            ADOTabularConnection c = new ADOTabularConnection("Data Source=localhost", AdomdType.AnalysisServices);
            MetaDataVisitorCSDL v = new MetaDataVisitorCSDL(c);
            System.Xml.XmlReader xr = new System.Xml.XmlTextReader(@"..\..\data\AdvWrks.xml");
            ADOTabularModel m = new ADOTabularModel(c, "Test","Test", "Test Description", "");
            var tabs = new ADOTabularTableCollection(c,m);
            v.GenerateTablesFromXmlReader(tabs, xr);

            Assert.AreEqual(15, tabs.Count);
            Assert.AreEqual(24, tabs["Sales Territory"].Columns.Count());
            Assert.AreEqual(1, tabs["Sales Territory"].Columns.Where((t) => t.ColumnType == ADOTabularColumnType.Hierarchy).Count());
            var h = (ADOTabularHierarchy) (tabs["Sales Territory"].Columns.Where((t) => t.ColumnType == ADOTabularColumnType.Hierarchy).First());
            Assert.AreEqual(3, h.Levels.Count);
            Assert.AreEqual("Group", h.Levels[0].LevelName);
            Assert.AreEqual("Country", h.Levels[1].LevelName);
            Assert.AreEqual("Region", h.Levels[2].LevelName);
        }
Exemplo n.º 5
0
        public void TestCSDLTablesWithSpaces()
        {
            ADOTabularConnection c = new ADOTabularConnection("Data Source=localhost", AdomdType.AnalysisServices);
            MetaDataVisitorCSDL v = new MetaDataVisitorCSDL(c);
            ADOTabularModel m = new ADOTabularModel(c, "Test","Test Caption", "Test Description", "");
            System.Xml.XmlReader xr = new System.Xml.XmlTextReader(@"..\..\data\advwrkscsdl.xml");
            var tabs = new ADOTabularTableCollection(c, m);
            v.GenerateTablesFromXmlReader(tabs, xr);
            var cmpyTab = tabs["Sales Quota"];

            Assert.AreEqual("Sales Quota", cmpyTab.Caption, "Table Name is translated");
        }
Exemplo n.º 6
0
        public void TestADOTabularCSDLVisitorKPI()
        {
            ADOTabularConnection c = new ADOTabularConnection("Data Source=localhost", AdomdType.AnalysisServices);
            MetaDataVisitorCSDL v = new MetaDataVisitorCSDL(c);
            System.Xml.XmlReader xr = new System.Xml.XmlTextReader(@"..\..\data\AdvWrks.xml");
            ADOTabularModel m = new ADOTabularModel(c, "Test", "Test Caption","Test Description", "");
            var tabs = new ADOTabularTableCollection(c, m);
            v.GenerateTablesFromXmlReader(tabs, xr);

            Assert.AreEqual(15, tabs.Count);
            Assert.AreEqual(24, tabs["Sales Territory"].Columns.Count());
            Assert.AreEqual(1, tabs["Sales Territory"].Columns.Where((t) => t.ColumnType == ADOTabularColumnType.Hierarchy).Count());
            var k = tabs["Sales Territory"].Columns["Total Current Quarter Sales Performance"] as ADOTabularKpi;
            Assert.AreEqual("Total Current Quarter Sales Performance", k.Caption);
            Assert.AreEqual("_Total Current Quarter Sales Performance Goal", k.Goal.Caption);
            Assert.AreEqual("_Total Current Quarter Sales Performance Status", k.Status.Caption);
        }
 public ADOTabularTableCollection(IADOTabularConnection adoTabConn, ADOTabularModel model)
 {
     _adoTabConn = adoTabConn;
     _model      = model;
 }
Exemplo n.º 8
0
 public void RefreshMetadata()
 {
     var _tmpModel = _selectedModel;
     _selectedModel = null;
     SelectedModel = _tmpModel;
 }