示例#1
0
        public DataSet GetSchemaDataSet(string schemaName, AdomdRestrictionCollection restrictions, bool throwOnInlineErrors)
        {
            if (_type == AdomdType.AnalysisServices)
            {
                global::Microsoft.AnalysisServices.AdomdClient.AdomdRestrictionCollection coll = new global::Microsoft.AnalysisServices.AdomdClient.AdomdRestrictionCollection();
                if (restrictions != null)
                {
                    foreach (AdomdClientWrappers.AdomdRestriction res in restrictions)
                    {
                        coll.Add(new global::Microsoft.AnalysisServices.AdomdClient.AdomdRestriction(res.Name, res.Value));
                    }
                }
                if (_conn.State != ConnectionState.Open)
                {
                    _conn.Open();
                }

                // wait 10 seconds before timing out
                if (Monitor.TryEnter(rowsetLock, new TimeSpan(0, 0, 10)))
                {
                    try
                    {
                        return(_conn.GetSchemaDataSet(schemaName, coll, throwOnInlineErrors));
                    }
                    finally
                    {
                        Monitor.Exit(rowsetLock);
                    }
                }
                else
                {
                    throw new InvalidOperationException("Timeout exceeded attempting to establish internal lock for GetSchemaDataSet");
                }
            }
            else
            {
                DataSet f()
                {
                    ExcelAdomdClientReference::Microsoft.AnalysisServices.AdomdClient.AdomdRestrictionCollection coll = new ExcelAdomdClientReference::Microsoft.AnalysisServices.AdomdClient.AdomdRestrictionCollection();
                    if (restrictions != null)
                    {
                        foreach (AdomdRestriction res in restrictions)
                        {
                            coll.Add(new ExcelAdomdClientReference::Microsoft.AnalysisServices.AdomdClient.AdomdRestriction(res.Name, res.Value));
                        }
                    }
                    if (_connExcel.State != ConnectionState.Open)
                    {
                        _connExcel.Open();
                    }
                    lock (rowsetLock)
                    {
                        return(_connExcel.GetSchemaDataSet(schemaName, coll, throwOnInlineErrors));
                    }
                }

                return(f());
            }
        }
示例#2
0
 public DataSet GetSchemaDataSet(string schemaName, AdomdRestrictionCollection restrictions, bool throwOnInlineErrors)
 {
     if (_type == AdomdType.AnalysisServices)
     {
         global::Microsoft.AnalysisServices.AdomdClient.AdomdRestrictionCollection coll = new global::Microsoft.AnalysisServices.AdomdClient.AdomdRestrictionCollection();
         if (restrictions != null)
         {
             foreach (AdomdClientWrappers.AdomdRestriction res in restrictions)
             {
                 coll.Add(new global::Microsoft.AnalysisServices.AdomdClient.AdomdRestriction(res.Name, res.Value));
             }
         }
         if (_conn.State != ConnectionState.Open)
         {
             _conn.Open();
         }
         return(_conn.GetSchemaDataSet(schemaName, coll, throwOnInlineErrors));
     }
     else
     {
         ExcelAdoMdConnections.ReturnDelegate <DataSet> f = delegate
         {
             ExcelAdomdClientReference::Microsoft.AnalysisServices.AdomdClient.AdomdRestrictionCollection coll = new ExcelAdomdClientReference::Microsoft.AnalysisServices.AdomdClient.AdomdRestrictionCollection();
             if (restrictions != null)
             {
                 foreach (AdomdRestriction res in restrictions)
                 {
                     coll.Add(new ExcelAdomdClientReference::Microsoft.AnalysisServices.AdomdClient.AdomdRestriction(res.Name, res.Value));
                 }
             }
             if (_connExcel.State != ConnectionState.Open)
             {
                 _connExcel.Open();
             }
             return(_connExcel.GetSchemaDataSet(schemaName, coll, throwOnInlineErrors));
         };
         return(f());
     }
 }
示例#3
0
        public DataSet GetSchemaDataSet(string schemaName, AdomdRestrictionCollection restrictions, bool throwOnInlineErrors)
        {
            if (_type == AdomdType.AnalysisServices)
            {
                global::Microsoft.AnalysisServices.AdomdClient.AdomdRestrictionCollection coll = new global::Microsoft.AnalysisServices.AdomdClient.AdomdRestrictionCollection();
                if (restrictions != null)
                {

                    foreach (AdomdClientWrappers.AdomdRestriction res in restrictions)
                    {
                        coll.Add(new global::Microsoft.AnalysisServices.AdomdClient.AdomdRestriction( res.Name, res.Value));
                    }
                }
                if (_conn.State != ConnectionState.Open)
                {
                    _conn.Open();
                }
                return _conn.GetSchemaDataSet(schemaName, coll, throwOnInlineErrors);
            }
            else
            {
                ExcelAdoMdConnections.ReturnDelegate<DataSet> f = delegate
                {
                    ExcelAdomdClientReference::Microsoft.AnalysisServices.AdomdClient.AdomdRestrictionCollection coll = new ExcelAdomdClientReference::Microsoft.AnalysisServices.AdomdClient.AdomdRestrictionCollection();
                    if (restrictions != null)
                    {
                        foreach (AdomdRestriction res in restrictions)
                        {
                            coll.Add(new ExcelAdomdClientReference::Microsoft.AnalysisServices.AdomdClient.AdomdRestriction(res.Name, res.Value));
                        }
                    }
                    if (_connExcel.State != ConnectionState.Open)
                    {
                        _connExcel.Open();
                    }
                    return _connExcel.GetSchemaDataSet(schemaName, coll, throwOnInlineErrors);
                };
                return f();
            }
        }