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.
Inheritance Hierarchy
System.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)
Syntax
'Declaration
Public Class TeamFoundationRequestContext _
Inherits RequestContextBase
public class TeamFoundationRequestContext : RequestContextBase
public ref class TeamFoundationRequestContext : public RequestContextBase
type TeamFoundationRequestContext =
class
inherit RequestContextBase
end
public class TeamFoundationRequestContext extends RequestContextBase
The TeamFoundationRequestContext type exposes the following members.
Properties
Name | Description | |
---|---|---|
ActivityId | The Activity ID of the thread used to create this request context. | |
AuthenticatedUserName | This gives the name of the user making the request. If there was not an authenticated user the username is returned as [String.Empty]. | |
AuthenticationType | ||
Command | This 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. | |
ContextId | This is a unique identifier that is assigned to each [RequestContextBase] as it is created. This identifier is never changed throughout the request execution. | |
DomainUserName | This should not be used. It is only here to allow for [backcompat] for existing services. | |
EndTime | This is the time the request ended. If the request is still active, [EndTime] will be equal to [DateTime.MinValue]. | |
ExecutionEnvironment | ||
IsServicingContext | Gets a value indicating whether this request context is being used in a servicing context. | |
IsSystemContext | Will return [true] when the context is being run as part of a system request and not associated with a client. | |
IsTracked | (Inherited from RequestContextBase.) | |
IsUserContext | Gets a value indicating whether this request context is being used as a user context. | |
Items | A property bag for storing items on the request context. Words that start with '$' are reserved. | |
Method | Retrieve the method information for this request. If the method has not started, or this is not a web method, this will return null. | |
Queued | A 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. | |
QueuedTime | If 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. | |
RecursiveSqlCalls | Used to capture the individual SQL Server calls. | |
RootContext | Gets the root context associated with this request context. | |
ServiceHost | Retrieves the [ServiceHost] this request is part of. | |
ServiceName | This property represents the Web service or application that is answering this request. The handling service can optionally set this property. | |
SqlCalls | Used to capture the individual SQL Server calls. | |
StartTime | This is the point that the request was started. | |
Status | Read and Write the current status of the request by setting an exception for this request. | |
UniqueIdentifier | Returns 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>] | |
UserContext | Surface the user associated with this Web request. |
Top
Methods
Name | Description | |
---|---|---|
BuildHyperlink(String) | ||
BuildHyperlink(String, Guid) | ||
Cancel | Synchronously cancels a request. | |
CreateComponent<TComponent>() | Creates a component that can be used to communicate to the current version of the database. | |
CreateComponent<TComponent>(String) | Creates a component that can be used to communicate to the current version of the database. | |
CreateHttpComponent<TComponent> | ||
CreateImpersonationContext | Impersonates the target identity on the current service host. The authenticated user will be the service account running the method. | |
Dispose() | (Inherited from RequestContextBase.) | |
Dispose(Boolean) | (Overrides RequestContextBase.Dispose(Boolean).) | |
Elevate() | Returns a SystemRequestContext. If the current context is a system context, it will return itself. | |
Elevate(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. | |
EnterCancelableRegion | Associates a cancelable object together with this request. | |
EnterMethod | [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. | |
Equals | Determines whether the specified object is equal to the current object. (Inherited from Object.) | |
ExitCancelableRegion | Removes an association of a cancelable object from this request. | |
Finalize | Make 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().) | |
GetAuthenticatedIdentity | The 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. | |
GetHashCode | Build a custom hash code for this object based on the primary values in the record. (Overrides Object.GetHashCode().) | |
GetReplicaAwareService<T> | ||
GetService<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. | |
GetSessionValue | [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. | |
GetSummary | A summary of the Team Foundation request context in string format. | |
GetType | Gets the Type of the current instance. (Inherited from Object.) | |
InitializeRecursiveSqlCalls | Used to capture the individual SQL Server calls on the current context and also to all associated System and User contexts. | |
IsCanceled | Determines if the current request has been canceled. | |
IsTracing | Returns [true] if tracing is enabled for the supplied arguments. | |
LeaveMethod | [LeaveMethod] is called when the scope of the method is being left. This enables the tracking of the scope of the method. | |
LogItem | Logs a key/value pair to the request context Items bag. | |
LogSqlCall | Add a SQL Server call to the SQL Server calls logs. | |
MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) | |
PartialResultsReady | [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. | |
SetMethodName | ||
SetSessionValue | [SetSessionValue] is used to add a name/value to the current requests session. | |
ThrowIfCanceled | Throws an exception if the current request has been canceled. | |
To | [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. | |
ToString | Returns a string that represents the current object. (Inherited from Object.) | |
Trace(Int32, TraceLevel, String, array<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. | |
Trace(Int32, TraceLevel, String, String, String, array<Object[]) | Trace without specific user-defined tags applied. | |
Trace(Int32, TraceLevel, String, String, array<String[], String, array<Object[]) | ||
TraceEnter | Trace on entry of a method. | |
TraceException(Int32, String, String, Exception) | Trace an exception. | |
TraceException(Int32, TraceLevel, String, String, Exception) | Trace an exception with an explicit level. | |
TraceLeave | Trace on exit of a method. | |
TraceSql | ||
TryGetItem<T> |
Top
Fields
Name | Description | |
---|---|---|
m_activityId |
Top
Thread Safety
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.