飞星
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

38 line
761 B

  1. using System;
  2. using Permission.Entity.DbContext;
  3. using Permission.Infrastructure.Core;
  4. namespace Permission.Data
  5. {
  6. public class BaseUnitOfWork : IBaseUnitOfWork, IDisposable
  7. {
  8. #region 数据上下文
  9. /// <summary>
  10. /// 数据上下文
  11. /// </summary>
  12. private PermissionContext _context;
  13. public BaseUnitOfWork(PermissionContext context)
  14. {
  15. _context = context;
  16. }
  17. #endregion
  18. public bool Commit()
  19. {
  20. return _context.SaveChanges() > 0;
  21. }
  22. public void Dispose()
  23. {
  24. if (_context != null)
  25. {
  26. _context.Dispose();
  27. }
  28. GC.SuppressFinalize(this);
  29. }
  30. }
  31. }