public void TestInitialize()
 {
     this.configuration = new TelemetryConfiguration();
     this.sendItems     = new List <ITelemetry>();
     this.configuration.TelemetryChannel = new StubTelemetryChannel {
         OnSend = item => this.sendItems.Add(item)
     };
     this.configuration.InstrumentationKey = Guid.NewGuid().ToString();
     this.sqlCommandProcessingProfiler     = new ProfilerSqlCommandProcessing(this.configuration, null, new ObjectInstanceBasedOperationHolder());
     this.sqlConnectionProcessingProfiler  = new ProfilerSqlConnectionProcessing(this.configuration, null, new ObjectInstanceBasedOperationHolder());
 }
Ejemplo n.º 2
0
        internal static void DecorateProfilerForSqlConnection(ref ProfilerSqlConnectionProcessing sqlCallbacks)
        {
            // Decorates SqlConnection.Open, 0 params(+this)
            // Tracks dependency call only in case of failure
            Functions.Decorate(
                "System.Data",
                "System.Data.dll",
                "System.Data.SqlClient.SqlConnection.Open",
                sqlCallbacks.OnBeginForOneParameter,
                null,
                sqlCallbacks.OnExceptionForOneParameter,
                isStatic: false);

            // Decorates SqlConnection.OpenAsync, 1 param(+this)
            // Tracks dependency call only in case of failure
            Functions.Decorate(
                "System.Data",
                "System.Data.dll",
                "System.Data.SqlClient.SqlConnection.OpenAsync",
                sqlCallbacks.OnBeginForTwoParameters,
                sqlCallbacks.OnEndExceptionAsyncForTwoParameters,
                null,
                isStatic: false);
        }