Class PluginTransactionLockFactory
Used for locking records while IN a transaction. This works by inserting a record of type lockEntityName with a particular guid. If another transaction tries to insert with the same guid, it will wait until the first transaction finishes.
public class PluginTransactionLockFactory
- Inheritance
-
PluginTransactionLockFactory
- Inherited Members
Constructors
PluginTransactionLockFactory(string)
Creates a new lock factory that will use the given entity name.
public PluginTransactionLockFactory(string lockEntityName)
Parameters
lockEntityName
string
Methods
Acquire(IOrganizationService, Guid)
Creates a lock for the given Guid
public IDisposable Acquire(IOrganizationService svc, Guid lockKey)
Parameters
svc
IOrganizationServiceThe OrganizationService to use for the request
lockKey
GuidOther transactions trying to lock this key will block until this transactions commits or rolls back.
Returns
- IDisposable
Calling Dispose will release the lock when the transaction commits.
Acquire(IOrganizationService, string)
Creates a lock for the given Guid
public IDisposable Acquire(IOrganizationService svc, string lockKey)
Parameters
svc
IOrganizationServiceThe OrganizationService to use for the request
lockKey
stringThe string key for the lock. Other transactions trying to lock this key will block until this transactions commits or rolls back.
Returns
- IDisposable
Calling Dispose will release the lock when the transaction commits.