using System;
namespace Csla
{
  /// 
  /// Marks a DataPortal_XYZ method to run within
  /// the specified transactional context.
  /// 
  /// 
  /// 
  /// Each business object method may be marked with this attribute
  /// to indicate which type of transactional technology should
  /// be used by the server-side DataPortal. The possible options
  /// are listed in the
  /// TransactionalTypes enum.
  /// 
  /// If the Transactional attribute is not applied to a 
  /// DataPortal_XYZ method then the
  /// Manual option
  /// is assumed.
  /// 
  /// If the Transactional attribute is applied with no explicit
  /// choice for transactionType then the
  /// EnterpriseServices 
  /// option is assumed.
  /// 
  /// Both the EnterpriseServices and TransactionScope options provide
  /// 2-phase distributed transactional support.
  /// 
  /// 
  [AttributeUsage(AttributeTargets.Method)]
  public sealed class TransactionalAttribute : Attribute
  {
    private TransactionalTypes _type;
    /// 
    /// Marks a method to run within a COM+
    /// transactional context.
    /// 
    public TransactionalAttribute()
    {
      _type = TransactionalTypes.EnterpriseServices;
    }
    /// 
    /// Marks a method to run within the specified
    /// type of transactional context.
    /// 
    /// 
    /// Specifies the transactional context within which the
    /// method should run.
    public TransactionalAttribute(TransactionalTypes transactionType)
    {
      _type = transactionType;
    }
    /// 
    /// Gets the type of transaction requested by the
    /// business object method.
    /// 
    public TransactionalTypes TransactionType
    {
      get { return _type; }
    }
  }
}