This topic has not yet been rated - Rate this topic

TeamFoundationRequestContext Class

All Requests in a Team Foundation application create a [TeamFoundationRequestContext] and the context is available from the application or one of the framework base classes.

Object
  Microsoft.TeamFoundation.Framework.Server.RequestContextBase
    Microsoft.TeamFoundation.Framework.Server.TeamFoundationRequestContext

Namespace:  Microsoft.TeamFoundation.Framework.Server
Assembly:  Microsoft.TeamFoundation.Framework.Server (in Microsoft.TeamFoundation.Framework.Server.dll)
public class TeamFoundationRequestContext : RequestContextBase

The TeamFoundationRequestContext type exposes the following members.

  NameDescription
Public propertyActivityIdThe Activity ID of the thread used to create this request context.
Public propertyAuthenticatedUserNameThis gives the name of the user making the request. If there was not an authenticated user the username is returned as [String.Empty].
Public propertyAuthenticationType
Public propertyCommandThis is a string that is supplied by the client that defines the intent of the user's command. For example, when you do a Get, you send [Command=Get] for all the downloads and [UpdateLocalVersion] calls. This lets you group calls together to determine all calls associated with a user action.
Public propertyContextIdThis is a unique identifier that is assigned to each [RequestContextBase] as it is created. This identifier is never changed throughout the request execution.
Public propertyDomainUserNameThis should not be used. It is only here to allow for [backcompat] for existing services.
Public propertyEndTimeThis is the time the request ended. If the request is still active, [EndTime] will be equal to [DateTime.MinValue].
Public propertyExecutionEnvironment
Public propertyIsServicingContextGets a value indicating whether this request context is being used in a servicing context.
Public propertyIsSystemContextWill return [true] when the context is being run as part of a system request and not associated with a client.
Public propertyIsTracked (Inherited from RequestContextBase.)
Public propertyIsUserContextGets a value indicating whether this request context is being used as a user context.
Public propertyItemsA property bag for storing items on the request context. Words that start with '$' are reserved.
Public propertyMethodRetrieve the method information for this request. If the method has not started, or this is not a web method, this will return null.
Public propertyQueuedA queued request is a request that is not currently processing. This means that its being held for one reason or another, for example, the server is too busy and is holding the request until the load lightens.
Public propertyQueuedTimeIf the request is currently queued, this will return the time that the request has been in the queue. Once the request leaves the queue, this will return the time that is spent in the queue.
Public propertyRecursiveSqlCallsUsed to capture the individual SQL Server calls.
Public propertyRootContextGets the root context associated with this request context.
Public propertyServiceHostRetrieves the [ServiceHost] this request is part of.
Public propertyServiceNameThis property represents the Web service or application that is answering this request. The handling service can optionally set this property.
Public propertySqlCallsUsed to capture the individual SQL Server calls.
Public propertyStartTimeThis is the point that the request was started.
Public propertyStatusRead and Write the current status of the request by setting an exception for this request.
Public propertyUniqueIdentifierReturns the optional command identifier specified by the client.This identifier is passed by the client in an HTTP Header in the formatted: X-TFS-Instance: <Guid>[,<Command>]
Public propertyUserContextSurface the user associated with this Web request.
Top
  NameDescription
Public methodBuildHyperlink(String)
Public methodBuildHyperlink(String, Guid)
Public methodCancelSynchronously cancels a request.
Public methodCreateComponent<TComponent>()Creates a component that can be used to communicate to the current version of the database.
Public methodCreateComponent<TComponent>(String)Creates a component that can be used to communicate to the current version of the database.
Public methodCreateHttpComponent<TComponent>
Public methodCreateImpersonationContextImpersonates the target identity on the current service host. The authenticated user will be the service account running the method.
Public methodDispose() (Inherited from RequestContextBase.)
Protected methodDispose(Boolean) (Overrides RequestContextBase.Dispose(Boolean).)
Public methodElevate()Returns a SystemRequestContext. If the current context is a system context, it will return itself.
Public methodElevate(Boolean)Returns a SystemRequestContext. If the current context is a system context, it will return itself.This [requestContext] is managed by the owning context and should not be disposed after the caller is finished, this will be done when the root context is disposed.
Public methodEnterCancelableRegionAssociates a cancelable object together with this request.
Public methodEnterMethod[EnterMethod] is called at the start of execution of a [WebMethod], [HttpHandler] or background job.[EnterMethod] should be called on the thread that is executing the request.
Public methodEqualsDetermines whether the specified object is equal to the current object. (Inherited from Object.)
Public methodExitCancelableRegionRemoves an association of a cancelable object from this request.
Protected methodFinalizeMake sure to release the locks when you are finalized even if you were not disposed. Normally this is considered an error caused by not disposing the object, but timing issues may prevent you from ever retrieving a reference to a newly created context. This finalizer will release the resources in this case. (Overrides Object.Finalize.)
Public methodGetAuthenticatedIdentityThe Authenticated identity is the identity of the user/service that is making this request. In the case of impersonation, this identity will be the one impersonating the [UserContext]. When impersonation is not being used, this identity will be the same as the one from the [UserContext].This is a function that has an out parameter instead of a property because it should not be easily confused with the [UserContext], which is the identity callers will be looking for most of the time.
Public methodGetHashCodeBuild a custom hash code for this object based on the primary values in the record. (Overrides Object.GetHashCode.)
Public methodGetReplicaAwareService<T>
Public methodGetService<T>Get an instance of the class specified by Type T.This object is the instance associated with this request context.If an instance is not yet associated with this context, one will be created and will then be returned in the future.These objects may be associated with the [ServiceHost] and have a longer life time than the request itself.
Public methodGetSessionValue[GetSessionValue] will examine the current request context and return the value for the supplied [sessionKey]. Sessions may be supported by the specific type of request context. This means that the caller must work even when sessions are not supported.If the request context supports sessions, it will maintain the values between calls for a given session. A session is often a process run by a single user where the server wants to allow the client to re-use a value for the duration of the process.
Public methodGetSummaryA summary of the Team Foundation request context in string format.
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Public methodInitializeRecursiveSqlCallsUsed to capture the individual SQL Server calls on the current context and also to all associated System and User contexts.
Public methodIsCanceledDetermines if the current request has been canceled.
Public methodIsTracingReturns [true] if tracing is enabled for the supplied arguments.
Public methodLeaveMethod[LeaveMethod] is called when the scope of the method is being left. This enables the tracking of the scope of the method.
Public methodLogItemLogs a key/value pair to the request context Items bag.
Public methodLogSqlCallAdd a SQL Server call to the SQL Server calls logs.
Protected methodMemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Public methodPartialResultsReady[PartialResultsReady] is called when the command is executing and the command has determined that enough of the result is ready but not all of it. This implies that the caller may start accessing data but there is more data for the response than is currently available.
Public methodSetMethodName
Public methodSetSessionValue[SetSessionValue] is used to add a name/value to the current requests session.
Public methodThrowIfCanceledThrows an exception if the current request has been canceled.
Public methodTo[To] is used to retrieve a [requestContext] that can be used to execute in a different service host. The root [requestContext] owns this context; therefore, the [requestContext] should not be disposed when the caller has finished with it. It will be disposed when the owning context is disposed.
Public methodToStringReturns a string that represents the current object. (Inherited from Object.)
Public methodTrace(Int32, TraceLevel, String, Object[])This form of [Trace] should generally be avoided because the omission of area and level means that these types of trace messages are not blocked by common trace filters.
Public methodTrace(Int32, TraceLevel, String, String, String, Object[])Trace without specific user-defined tags applied.
Public methodTrace(Int32, TraceLevel, String, String, String[], String, Object[])
Public methodTraceEnterTrace on entry of a method.
Public methodTraceException(Int32, String, String, Exception)Trace an exception.
Public methodTraceException(Int32, TraceLevel, String, String, Exception)Trace an exception with an explicit level.
Public methodTraceLeaveTrace on exit of a method.
Public methodTraceSql
Public methodTryGetItem<T>
Top
  NameDescription
Protected fieldm_activityId
Top
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Did you find this helpful?
(1500 characters remaining)
© 2013 Microsoft. All rights reserved.