ISourceRepository.cs 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. using DataTransmission.Entity;
  2. using Hotline.Settings;
  3. using SnapshotWinFormsApp.Entities.NewHotline;
  4. using SnapshotWinFormsApp.Entities.OldHotline;
  5. using SqlSugar;
  6. using System;
  7. using System.Collections.Generic;
  8. using System.Data;
  9. using System.Linq;
  10. using System.Text;
  11. using System.Threading.Tasks;
  12. namespace SnapshotWinFormsApp.Repository.Interfaces;
  13. /// <summary>
  14. /// 操作老系统的仓储
  15. /// </summary>
  16. /// <typeparam name="T"></typeparam>
  17. /// <typeparam name="TKey"></typeparam>
  18. public interface ISourceRepository<T, TKey> where T : OldBaseEntity<TKey>, new()
  19. {
  20. ISugarQueryable<T> Queryable();
  21. T GetById(int id);
  22. Task<List<T>> GetAllAsync(CancellationToken token);
  23. DataTable GetDataTable(string sql, List<SugarParameter> parameters = null);
  24. }
  25. /// <summary>
  26. /// 操作新系统, 但是不需要插入数据的仓储
  27. /// </summary>
  28. /// <typeparam name="T"></typeparam>
  29. public interface ISelectRepository<T> where T : DataTransmission.Entity.Entity, new()
  30. {
  31. ISugarQueryable<T> Queryable();
  32. T GetById(string id);
  33. Task<List<T>> GetAllAsync(CancellationToken token);
  34. IList<T> GetAll();
  35. }
  36. /// <summary>
  37. /// 操作新系统插入的仓储
  38. /// </summary>
  39. /// <typeparam name="T"></typeparam>
  40. public interface ITargetRepository<T> where T : OldIdEntity, new()
  41. {
  42. SqlSugarClient db { get; }
  43. ISugarQueryable<T> Queryable();
  44. T GetById(int id);
  45. Task<IList<T>> GetAllAsync(CancellationToken token);
  46. Task<string> InsertAsync(T entity, CancellationToken token);
  47. string InsertBulk(T entity, bool isEnd);
  48. void Update(T entity);
  49. IUpdateable<T> Updateable();
  50. Task<int> ExecuteSqlAsync(string sql);
  51. DataTable GetDataTable(string sql);
  52. IList<T> GetAll();
  53. }