Microsoft.AnalysisServices.AdomdClient.AdomdConnection.Open()

Here are the examples of the csharp api class Microsoft.AnalysisServices.AdomdClient.AdomdConnection.Open() taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

8 Examples 7

1. Example

Project: MdxClient
Source File: MdxConnection.cs
public override void Open()
        {
            _connection.Open();
        }

2. Example

Project: NBi
Source File: MembersCommand.cs
protected CellSet ExecuteCellSet(AdomdCommand cmd)
        {
            CellSet cs = null;
            try
            {
                cmd.Connection.Open();
                cs = cmd.ExecuteCellSet();
                cmd.Connection.Close();
            }
            catch (AdomdConnectionException ex)
            { throw new ConnectionException(ex, cmd.Connection.ConnectionString); }
            catch (AdomdErrorResponseException ex)
            { throw new ConnectionException(ex, cmd.Connection.ConnectionString); }

            return cs;
        }

3. Example

Project: Test.Automation
Source File: MdxHelper.cs
[SuppressMessage("Microsoft.Security", "CA2100:Review SQL queries for security vulnerabilities", Justification = "Mdx injection is in this case expected.")]
        public static ICollection<string> ExecuteMdxCommand(string command, string connectionString, int index)
        {
            Logger.Debug(CultureInfo.CurrentCulture, "Send mdx query.");
            Logger.Debug(CultureInfo.CurrentCulture, "Query: {0}", command);
            Logger.Debug(CultureInfo.CurrentCulture, "AS connection string: {0}", connectionString);
            Logger.Debug(CultureInfo.CurrentCulture, "Index: {0}", index);

            var resultList = new List<string>();
            using (var connection = new AdomdConnection(connectionString))
            {
                connection.Open();

                using (var mdxCommand = new AdomdCommand(command, connection))
                {
                    using (var mdxReader = mdxCommand.ExecuteReader())
                    {
                        while (mdxReader.Read())
                        {
                            ////getName - column name
                            resultList.Add(mdxReader[index].ToString());
                        }
                    }
                }

                return resultList;
            }
        }

4. Example

Project: NBi
Source File: DataTypeDiscoveryFactoryProvider.cs
protected virtual string InquireFurtherAnalysisService(string connectionString)
        {
            try
            {
                var parsedMode = string.Empty;
                using (var conn = new AdomdConnection(connectionString))
                {
                    conn.Open();
                    var restrictions = new AdomdRestrictionCollection();
                    restrictions.Add(new AdomdRestriction("ObjectExpansion", "ReferenceOnly"));
                    var ds = conn.GetSchemaDataSet("DISCOVER_XML_METADATA", restrictions);
                    var xml = ds.Tables[0].Rows[0].ItemArray[0].ToString();
                    var doc = new XmlDocument();
                    doc.LoadXml(xml);
                    parsedMode = ParseXmlaResponse(doc);
                }


                switch (parsedMode)
                {
                    case "Default": return Olap;
                    case "Multidimensional": return Olap;
                    case "SharePoint": return Tabular;
                    case "Tabular": return Tabular;
                }
            }
            catch (Exception ex)
            {
                Trace.WriteLineIf(NBiTraceSwitch.TraceWarning,"Can't detect server mode for SSAS, using Olap. Initial message:" + ex.Message);
                return Olap;
            }
            return Olap;

        }

5. Example

Project: NBi
Source File: QueryAdomdEngine.cs
public PerformanceResult CheckPerformance(int timeout)
        {
            bool isTimeout = false;
            DateTime tsStart, tsStop = DateTime.Now;

            Trace.WriteLineIf(NBiTraceSwitch.TraceVerbose, command.CommandText);
            foreach (AdomdParameter param in command.Parameters)
                Trace.WriteLineIf(NBiTraceSwitch.TraceVerbose, string.Format("{0} => {1}", param.ParameterName, param.Value));


            if (command.Connection.State == ConnectionState.Closed)
                command.Connection.Open();

            tsStart = DateTime.Now;
            try
            {
                command.ExecuteNonQuery();
                tsStop = DateTime.Now;
            }
            catch (AdomdException e)
            {
                if (!e.Message.StartsWith("Timeout expired."))
                    throw;
                isTimeout = true;
            }

            if (command.Connection.State == ConnectionState.Open)
                command.Connection.Close();

            if (isTimeout)
                return PerformanceResult.Timeout(timeout);
            else
                return new PerformanceResult(tsStop.Subtract(tsStart));
        }

6. Example

Project: NBi
Source File: QueryAdomdEngine.cs
public void CleanCache()
        {
            using (var conn = new AdomdConnection(command.Connection.ConnectionString))
            {
                string xmla = string.Empty;
                using (var stream = Assembly.GetExecutingAssembly()
                                           .GetManifestResourceStream("NBi.Core.Query.CleanCache.xmla"))
                    using (var reader = new StreamReader(stream))
                        xmla = reader.ReadToEnd();

                var csb = new DbConnectionStringBuilder();
                csb.ConnectionString = conn.ConnectionString;
                if (!csb.ContainsKey("Initial Catalog"))
                    throw new ArgumentException("The token 'Initial Catalog' was not provided in the connection string due to this, it was impossible to clean the cache of the database.");

                conn.Open();
                using (var cleanCmd = new AdomdCommand(string.Format(xmla, csb["Initial Catalog"]), conn))
                    cleanCmd.ExecuteNonQuery();
            }
        }

7. Example

Project: NBi
Source File: StructureDiscoveryFactoryProvider.cs
protected virtual string InquireFurtherAnalysisService(string connectionString)
        {
            try
            {
                var parsedMode = string.Empty;
                using (var conn = new AdomdConnection(connectionString))
                {
                    conn.Open();
                    var restrictions = new AdomdRestrictionCollection();
                    restrictions.Add(new AdomdRestriction("ObjectExpansion", "ReferenceOnly"));
                    var ds = conn.GetSchemaDataSet("DISCOVER_XML_METADATA", restrictions);
                    var xml = ds.Tables[0].Rows[0].ItemArray[0].ToString();
                    var doc = new XmlDocument();
                    doc.LoadXml(xml);
                    parsedMode = ParseXmlaResponse(doc);
                }


                switch (parsedMode)
                {
                    case "Default": return Olap;
                    case "Multidimensional": return Olap;
                    case "SharePoint": return Tabular;
                    case "Tabular": return Tabular;
                }
            }
            catch (Exception ex)
            {
                Trace.WriteLineIf(NBiTraceSwitch.TraceWarning,"Can't detect server mode for SSAS, using Olap. Initial message:" + ex.Message);
                return Olap;
            }
            return Olap;

        }

8. Example

Project: NBi
Source File: QueryAdomdEngine.cs
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2100:Review SQL queries fo/n ..... /n //View Source file for more details /n }