Table of Contents

Class PluginTransactionLockFactory

Namespace
Hsl.Xrm.Sdk.Plugin
Assembly
Hsl.Xrm.Sdk.Plugin.dll

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 IOrganizationService

The OrganizationService to use for the request

lockKey Guid

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.

Acquire(IOrganizationService, string)

Creates a lock for the given Guid

public IDisposable Acquire(IOrganizationService svc, string lockKey)

Parameters

svc IOrganizationService

The OrganizationService to use for the request

lockKey string

The 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.