Click or drag to resize

ITransactionScope Interface

Interface for database transaction

Namespace:  EBP.Api.Interfaces.Database
Assembly:  EBP.Api.Common (in EBP.Api.Common.dll) Version: 1.0.2835.45 (1.0.2835.45)
Syntax
public interface ITransactionScope : IDisposable, 
	IEquatable<IProxy>

The ITransactionScope type exposes the following members.

Properties
  NameDescription
Public propertyDatabase
Sets the database.
Public propertyRootScope
Returns true if this transaction is in the root scope, otherwise false.
Public propertyScopeLevel
Scope level
Top
Methods
  NameDescription
Public methodComplete
Commits the database transaction
Public methodDispose
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
(Inherited from IDisposable.)
Top
Remarks
The ITransactionScope type can be instantiated with EBP.Api.Utils<TExtension>.GetInterface<T>
ITransactionScope instance = Utils<ExtensionType>.GetInterface<ITransactionScope>();
Examples
This sample shows how to use the transaction scope
using(ITransactionScope ts = Utils<ExentensionType>.GetInterface<ITransactionScope>())
{
  // Set transaction database
  ts.Database = MyExtension.Instance.Database;

  // Execute update or insert queries...

  if (ts.Complete())
  {
    // Resume treatement infos
  }
  else
  {
    // Show transaction error standard message
    Utils<MyExtension>.ShowErrors(MyExtension.HostOwnerForm, ErrorKind.Error,
    "Echec de transaction");
  }
}
See Also