TeamFoundationRequestContext.GetReplicaAwareService<T> Method

Get an instance of the class specified by Type T, corresponding to the replica where this request context is mapped to. This object is the instance associated with this request context. If T factory instance service doesn't exist, it is created and initialized with T instance for each available replica. This function is deterministic per user (as long as replica count doesn't change). Requests from same user will return the same T instance. Note these objects may be associated with the ServiceHost and have a longer life time than the request itself.

Namespace:  Microsoft.TeamFoundation.Framework.Server
Assembly:  Microsoft.TeamFoundation.Framework.Server (in Microsoft.TeamFoundation.Framework.Server.dll)

Syntax

'Declaration
Public Overridable Function GetReplicaAwareService(Of T As {Class, New, ITeamFoundationReplicaAwareService}) As T
public virtual T GetReplicaAwareService<T>()
where T : class, new(), ITeamFoundationReplicaAwareService
public:
generic<typename T>
where T : ref class, gcnew(), ITeamFoundationReplicaAwareService 
virtual T GetReplicaAwareService()
abstract GetReplicaAwareService : unit -> 'T  when 'T : not struct, new() and ITeamFoundationReplicaAwareService 
override GetReplicaAwareService : unit -> 'T  when 'T : not struct, new() and ITeamFoundationReplicaAwareService
JScript does not support generic types or methods.

Type Parameters

  • T
    Class type of the object to retrieve. Class must implement ITeamFoundationReplicaAwareService, be non-abstract and have a parameterless or default constructor.

Return Value

Type: T
Returns an instance of the object specified by Type T associated with this request.

.NET Framework Security

See Also

Reference

TeamFoundationRequestContext Class

Microsoft.TeamFoundation.Framework.Server Namespace