using System; using System.Collections.Generic; using System.Threading.Tasks; using Abp.Domain.Entities; namespace Abp.Domain.Uow { /// /// This interface is used to work with active unit of work. /// This interface can not be injected. /// Use instead. /// public interface IActiveUnitOfWork { /// /// This event is raised when this UOW is successfully completed. /// event EventHandler Completed; /// /// This event is raised when this UOW is failed. /// event EventHandler Failed; /// /// This event is raised when this UOW is disposed. /// event EventHandler Disposed; /// /// Gets if this unit of work is transactional. /// UnitOfWorkOptions Options { get; } /// /// Gets data filter configurations for this unit of work. /// IReadOnlyList Filters { get; } /// /// A dictionary to use for custom operations on unitOfWork /// Dictionary Items { get; set; } /// /// Is this UOW disposed? /// bool IsDisposed { get; } /// /// Saves all changes until now in this unit of work. /// This method may be called to apply changes whenever needed. /// Note that if this unit of work is transactional, saved changes are also rolled back if transaction is rolled back. /// No explicit call is needed to SaveChanges generally, /// since all changes saved at end of a unit of work automatically. /// void SaveChanges(); /// /// Saves all changes until now in this unit of work. /// This method may be called to apply changes whenever needed. /// Note that if this unit of work is transactional, saved changes are also rolled back if transaction is rolled back. /// No explicit call is needed to SaveChanges generally, /// since all changes saved at end of a unit of work automatically. /// Task SaveChangesAsync(); /// /// Disables one or more data filters. /// Does nothing for a filter if it's already disabled. /// Use this method in a using statement to re-enable filters if needed. /// /// One or more filter names. for standard filters. /// A handle to take back the disable effect. IDisposable DisableFilter(params string[] filterNames); /// /// Enables one or more data filters. /// Does nothing for a filter if it's already enabled. /// Use this method in a using statement to re-disable filters if needed. /// /// One or more filter names. for standard filters. /// A handle to take back the enable effect. IDisposable EnableFilter(params string[] filterNames); /// /// Checks if a filter is enabled or not. /// /// Name of the filter. for standard filters. bool IsFilterEnabled(string filterName); /// /// Sets (overrides) value of a filter parameter. /// /// Name of the filter /// Parameter's name /// Value of the parameter to be set IDisposable SetFilterParameter(string filterName, string parameterName, object value); /// /// Sets/Changes Tenant's Id for this UOW. /// /// The tenant id. /// A disposable object to restore old TenantId value when you dispose it IDisposable SetTenantId(int? tenantId); /// /// Sets/Changes Tenant's Id for this UOW. /// /// The tenant id /// /// True to enable/disable based on given tenantId. /// Enables filter if tenantId is not null. /// Disables filter if tenantId is null. /// This value is true for method. /// /// A disposable object to restore old TenantId value when you dispose it IDisposable SetTenantId(int? tenantId, bool switchMustHaveTenantEnableDisable); /// /// Gets Tenant Id for this UOW. /// /// int? GetTenantId(); } }