ITraceWriterExtensions.TraceBeginEndAsync Method
Assembly: System.Web.Http (in System.Web.Http.dll)
| Name | Description | |
|---|---|---|
![]() ![]() | TraceBeginEndAsync(ITraceWriter, HttpRequestMessage, String, TraceLevel, String, String, Action<TraceRecord>, Func<Task>, Action<TraceRecord>, Action<TraceRecord>) | Traces both a begin and an end trace around a specified operation. |
![]() ![]() | TraceBeginEndAsync<TResult>(ITraceWriter, HttpRequestMessage, String, TraceLevel, String, String, Action<TraceRecord>, Func<Task<TResult>>, Action<TraceRecord, TResult>, Action<TraceRecord>) | Traces both a begin and an end trace around a specified operation. |
ITraceWriterExtensions.TraceBeginEndAsync Method (ITraceWriter, HttpRequestMessage, String, TraceLevel, String, String, Action<TraceRecord>, Func<Task>, Action<TraceRecord>, Action<TraceRecord>)
Traces both a begin and an end trace around a specified operation.
public static Task TraceBeginEndAsync( this ITraceWriter traceWriter, HttpRequestMessage request, string category, TraceLevel level, string operatorName, string operationName, Action<TraceRecord> beginTrace, Func<Task> execute, Action<TraceRecord> endTrace, Action<TraceRecord> errorTrace )
Parameters
- traceWriter
-
Type:
System.Web.Http.Tracing.ITraceWriter
The ITraceWriter.
- request
-
Type:
System.Net.Http.HttpRequestMessage
The HttpRequestMessage with which to associate the trace. It may be null.
- category
-
Type:
System.String
The logical category of the trace.
- level
-
Type:
System.Web.Http.Tracing.TraceLevel
The TraceLevel of the trace.
- operatorName
-
Type:
System.String
The name of the object performing the operation. It may be null.
- operationName
-
Type:
System.String
The name of the operation being performed. It may be null.
- beginTrace
-
Type:
System.Action<TraceRecord>
The Action to invoke prior to performing the operation, allowing the given TraceRecord to be filled in. It may be null.
- execute
-
Type:
System.Func<Task>
An <see cref="T:System.Func`1" /> that returns the Task that will perform the operation.
- endTrace
-
Type:
System.Action<TraceRecord>
The Action to invoke after successfully performing the operation, allowing the given TraceRecord to be filled in. It may be null.
- errorTrace
-
Type:
System.Action<TraceRecord>
The Action to invoke if an error was encountered performing the operation, allowing the given TraceRecord to be filled in. It may be null.
ITraceWriterExtensions.TraceBeginEndAsync<TResult> Method (ITraceWriter, HttpRequestMessage, String, TraceLevel, String, String, Action<TraceRecord>, Func<Task<TResult>>, Action<TraceRecord, TResult>, Action<TraceRecord>)
Traces both a begin and an end trace around a specified operation.
public static Task<TResult> TraceBeginEndAsync<TResult>( this ITraceWriter traceWriter, HttpRequestMessage request, string category, TraceLevel level, string operatorName, string operationName, Action<TraceRecord> beginTrace, Func<Task<TResult>> execute, Action<TraceRecord, TResult> endTrace, Action<TraceRecord> errorTrace )
Parameters
- traceWriter
-
Type:
System.Web.Http.Tracing.ITraceWriter
The ITraceWriter.
- request
-
Type:
System.Net.Http.HttpRequestMessage
The HttpRequestMessage with which to associate the trace. It may be null.
- category
-
Type:
System.String
The logical category of the trace.
- level
-
Type:
System.Web.Http.Tracing.TraceLevel
The TraceLevel of the trace.
- operatorName
-
Type:
System.String
The name of the object performing the operation. It may be null.
- operationName
-
Type:
System.String
The name of the operation being performed. It may be null.
- beginTrace
-
Type:
System.Action<TraceRecord>
The Action to invoke prior to performing the operation, allowing the given TraceRecord to be filled in. It may be null.
- execute
-
Type:
System.Func<Task<TResult>>
An <see cref="T:System.Func`1" /> that returns the Task that will perform the operation.
- endTrace
-
Type:
System.Action<TraceRecord, TResult>
The Action to invoke after successfully performing the operation, allowing the given TraceRecord to be filled in. The result of the completed task will also be passed to this action. This action may be null.
- errorTrace
-
Type:
System.Action<TraceRecord>
The Action to invoke if an error was encountered performing the operation, allowing the given TraceRecord to be filled in. It may be null.
Type Parameters
- TResult
The type of result produced by the Task.

