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.
Inheritance
Inherited Members
Namespace: Hsl.Xrm.Sdk.Plugin
Assembly: Hsl.Xrm.Sdk.Plugin.dll
Syntax
public class PluginTransactionLockFactory
Constructors
PluginTransactionLockFactory(String)
Creates a new lock factory that will use the given entity name.
Declaration
public PluginTransactionLockFactory(string lockEntityName)
Parameters
Type | Name | Description |
---|---|---|
System.String | lockEntityName |
Methods
Acquire(IOrganizationService, Guid)
Creates a lock for the given Guid
Declaration
public IDisposable Acquire(IOrganizationService svc, Guid lockKey)
Parameters
Type | Name | Description |
---|---|---|
Microsoft.Xrm.Sdk.IOrganizationService | svc | The OrganizationService to use for the request |
System.Guid | lockKey | Other transactions trying to lock this key will block until this transactions commits or rolls back. |
Returns
Type | Description |
---|---|
System.IDisposable | Calling Dispose will release the lock when the transaction commits. |
Acquire(IOrganizationService, String)
Creates a lock for the given Guid
Declaration
public IDisposable Acquire(IOrganizationService svc, string lockKey)
Parameters
Type | Name | Description |
---|---|---|
Microsoft.Xrm.Sdk.IOrganizationService | svc | The OrganizationService to use for the request |
System.String | lockKey | The string key for the lock. Other transactions trying to lock this key will block until this transactions commits or rolls back. |
Returns
Type | Description |
---|---|
System.IDisposable | Calling Dispose will release the lock when the transaction commits. |