Freigeben über


TeamFoundationLockingService.AcquireLocks Method (TeamFoundationRequestContext, TeamFoundationLockMode, array<String )

Gets cross-process locks on one or more resources.

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

Syntax

'Declaration
Public Function AcquireLocks ( _
    requestContext As TeamFoundationRequestContext, _
    lockMode As TeamFoundationLockMode, _
    ParamArray resources As String() _
) As TeamFoundationLock
public TeamFoundationLock AcquireLocks(
    TeamFoundationRequestContext requestContext,
    TeamFoundationLockMode lockMode,
    params string[] resources
)
public:
TeamFoundationLock^ AcquireLocks(
    TeamFoundationRequestContext^ requestContext, 
    TeamFoundationLockMode lockMode, 
    ... array<String^>^ resources
)
member AcquireLocks : 
        requestContext:TeamFoundationRequestContext * 
        lockMode:TeamFoundationLockMode * 
        resources:string[] -> TeamFoundationLock
public function AcquireLocks(
    requestContext : TeamFoundationRequestContext, 
    lockMode : TeamFoundationLockMode, 
    ... resources : String[]
) : TeamFoundationLock

Parameters

  • resources
    Type: array<System.String[]

    The resources to lock on.

Return Value

Type: Microsoft.TeamFoundation.Framework.Server.TeamFoundationLock
The lock on this resource if obtained within the timeout. This lock should be disposed when it needs to be released.

Exceptions

Exception Condition
LockTimeoutException

Thrown if a resource wasn't locked within the timeout supplied.

Remarks

The resources are locked in the order supplied. Order your resources in a consistent manner to avoid deadlocks.

.NET Framework Security

See Also

Reference

TeamFoundationLockingService Class

AcquireLocks Overload

Microsoft.TeamFoundation.Framework.Server Namespace