コード例 #1
0
 public static void DisposeDataExtensionObject <T>(ref T obj, string objectType, string dataSetName, DataProcessingMetrics executionMetrics, DataProcessingMetrics.MetricType?metricType) where T : class, IDisposable
 {
     if (obj != null)
     {
         if (metricType.HasValue)
         {
             executionMetrics.StartTimer(metricType.Value);
         }
         try
         {
             obj.Dispose();
         }
         catch (RSException)
         {
             throw;
         }
         catch (Exception ex2)
         {
             if (AsynchronousExceptionDetection.IsStoppingException(ex2))
             {
                 throw;
             }
             Global.Tracer.Trace(TraceLevel.Warning, "Error occurred while disposing the " + objectType + " for DataSet '" + dataSetName.MarkAsPrivate() + "'. Details: " + ex2.ToString());
         }
         finally
         {
             obj = null;
             if (metricType.HasValue)
             {
                 executionMetrics.RecordTimerMeasurementWithUpdatedTotal(metricType.Value);
             }
         }
     }
 }
コード例 #2
0
        public static IDbConnection OpenConnection(AspNetCore.ReportingServices.ReportIntermediateFormat.DataSource dataSourceObj, AspNetCore.ReportingServices.ReportIntermediateFormat.DataSet dataSetObj, OnDemandProcessingContext pc, DataProcessingMetrics metrics)
        {
            IDbConnection dbConnection = null;

            try
            {
                metrics.StartTimer(DataProcessingMetrics.MetricType.OpenConnection);
                DataSourceInfo dataSourceInfo = null;
                string         text           = dataSourceObj.ResolveConnectionString(pc, out dataSourceInfo);
                if (pc.UseVerboseExecutionLogging)
                {
                    metrics.ResolvedConnectionString = text;
                }
                //if (pc.CreateAndSetupDataExtensionFunction.MustResolveSharedDataSources)
                //{

                //}

                return(pc.CreateAndSetupDataExtensionFunction.OpenDataSourceExtensionConnection(dataSourceObj, text, dataSourceInfo, dataSetObj.Name));
            }
            catch (RSException)
            {
                throw;
            }
            catch (Exception ex2)
            {
                if (AsynchronousExceptionDetection.IsStoppingException(ex2))
                {
                    throw;
                }
                throw new ReportProcessingException(ErrorCode.rsErrorOpeningConnection, ex2, dataSourceObj.Name);
            }
            finally
            {
                long num = metrics.RecordTimerMeasurementWithUpdatedTotal(DataProcessingMetrics.MetricType.OpenConnection);
                Global.Tracer.Trace(TraceLevel.Verbose, "Opening a connection for DataSource: {0} took {1} ms.", dataSourceObj.Name.MarkAsModelInfo(), num);
            }
        }