DataConnection.GetExclusiveAccessProxy Method
Retrieves a proxy instance that allows the caller exclusive access to the data connection.
Namespace: Microsoft.VisualStudio.Data
Assembly: Microsoft.VisualStudio.Data (in Microsoft.VisualStudio.Data.dll)
Syntax
'Declaration
Public MustOverride Function GetExclusiveAccessProxy ( _
lockTimeout As Integer _
) As DataConnection
public abstract DataConnection GetExclusiveAccessProxy(
int lockTimeout
)
public:
virtual DataConnection^ GetExclusiveAccessProxy(
int lockTimeout
) abstract
abstract GetExclusiveAccessProxy :
lockTimeout:int -> DataConnection
public abstract function GetExclusiveAccessProxy(
lockTimeout : int
) : DataConnection
Parameters
- lockTimeout
Type: System.Int32
The amount of time, in seconds, to wait on locking the connection before returning.
Return Value
Type: Microsoft.VisualStudio.Data.DataConnection
Returns a proxy DataConnection object instance that allows the caller exclusive access to the connection, or returns nulla null reference (Nothing in Visual Basic) if the lock timeout was reached and the connection could not be locked.
Exceptions
Exception | Condition |
---|---|
InvalidOperationException | This object is an exclusive access proxy that no longer has exclusive access. |
Remarks
Normally, locking of the connection occurs on a per-thread basis, ensuring that multiple threads cannot interact with the data connection at the same time. However, in some cases this is not an appropriate mechanism of locking for the client, as when a client wishes to perform a locked operation using a single connection that spans multiple threads. In such cases, a client can call this method to retrieve a non-locking instance of the connection on which they can then perform their own serialized access.
The object returned by this method is a new instance of the DataConnection class that has a special attribute allowing only calls through this instance to succeed. Calls through any other references to the original DataConnection object are then blocked until the ReleaseExclusiveAccessProxy method is called on the exclusive access proxy.
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.