public static void SendXMLA([SqlFacet(MaxSize = -1, IsNullable = false)] SqlString XMLA
                                , out SqlXml ReturnXMLA
                                , [SqlFacet(MaxSize = 255, IsNullable = true)] SqlString SSAS_Server)
    {
        XmlaClient clnt = new XmlaClient();

        clnt.Connect(SSAS_Server.IsNull ? OneIncOLAPExtensions.SSAS_Server.Value : SSAS_Server.Value);

        using (var reader = new StringReader(clnt.Send(XMLA.Value, null)))
            using (var xmlreader = new XmlTextReader(reader))
                ReturnXMLA = new SqlXml(xmlreader);

        clnt.Disconnect();
    }
Exemple #2
0
        static void Main(string[] args)
        {
            Console.Write("Server:");
            string server = Console.ReadLine();

            Console.Write("Database:");
            string database = Console.ReadLine();

            Console.Write("WaitIntervalInMiliSeconds:");
            string interval = Console.ReadLine();
            int    waitIntervalInMiliSeconds;

            Int32.TryParse(interval, out waitIntervalInMiliSeconds);

            XmlaClient clnt = new XmlaClient();

            int counter = 0;

            while (true)
            {
                clnt.Connect(server);

                string xmla = String.Format(@"<ClearCache xmlns=""http://schemas.microsoft.com/analysisservices/2003/engine"">  
                                    <Object>
                                        <DatabaseID>{0}</DatabaseID>
                                    </Object >
                                </ClearCache>", database);

                Console.WriteLine("Clearing cache (counter=" + counter + ")");

                clnt.Send(xmla, null);

                clnt.Disconnect();

                Thread.Sleep(waitIntervalInMiliSeconds);

                counter++;
            }
        }
Exemple #3
0
        public void ClearCache()
        {
            XmlaClient clnt = new XmlaClient();
            string     xmla;

            clnt.Connect(SSASConnection.ConnectionString);
            xmla = @"<ClearCache xmlns=""http://schemas.microsoft.com/analysisservices/2003/engine"">
                    <Object>
                    <DatabaseID>" + this.DatabaseName + @"</DatabaseID>
                    </Object>
                    </ClearCache>";
            try
            {
                clnt.Send(xmla, null);
            }
            catch (XmlaException e)
            {
                clnt.Disconnect();
                throw new Exception(e.Message, e);
            }

            clnt.Disconnect();
        }
 /// <summary>
 /// Execute XMLA script for creating multidimensional project.
 /// </summary>
 public static void ExecuteXMLAScript()
 {
     string connectionString =
     ConfigurationManager.ConnectionStrings["ConnectionStringAnalysisServices"].ToString();
       var client = new XmlaClient();
       var builder = new SqlConnectionStringBuilder(connectionString);
       client.Connect(builder.DataSource);
       string xmla = File.ReadAllText(Environment.CurrentDirectory + @"\Resources\XMLAQuery2.xmla");
       client.Send(xmla, null);
       client.Disconnect();
 }