NullUnitOfWork.cs 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. using System.Threading.Tasks;
  2. namespace Abp.Domain.Uow
  3. {
  4. /// <summary>
  5. /// Null implementation of unit of work.
  6. /// It's used if no component registered for <see cref="IUnitOfWork"/>.
  7. /// This ensures working ABP without a database.
  8. /// </summary>
  9. public sealed class NullUnitOfWork : UnitOfWorkBase
  10. {
  11. public override void SaveChanges()
  12. {
  13. }
  14. public override Task SaveChangesAsync()
  15. {
  16. return Task.FromResult(0);
  17. }
  18. protected override void BeginUow()
  19. {
  20. }
  21. protected override void CompleteUow()
  22. {
  23. }
  24. protected override Task CompleteUowAsync()
  25. {
  26. return Task.FromResult(0);
  27. }
  28. protected override void DisposeUow()
  29. {
  30. }
  31. public NullUnitOfWork(
  32. IConnectionStringResolver connectionStringResolver,
  33. IUnitOfWorkDefaultOptions defaultOptions,
  34. IUnitOfWorkFilterExecuter filterExecuter
  35. ) : base(
  36. connectionStringResolver,
  37. defaultOptions,
  38. filterExecuter)
  39. {
  40. }
  41. }
  42. }