IRepository.cs 1.0 KB

123456789101112131415161718192021222324252627282930313233
  1. using SnapshotWinFormsApp.Entities.NewHotline;
  2. using SnapshotWinFormsApp.Entities.OldHotline;
  3. using SqlSugar;
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Data;
  7. using System.Linq;
  8. using System.Text;
  9. using System.Threading.Tasks;
  10. namespace SnapshotWinFormsApp.Repository.Interfaces;
  11. public interface IRepository<T, TKey> where T : OldBaseEntity<TKey>, new()
  12. {
  13. ISugarQueryable<T> Queryable();
  14. T GetById(int id);
  15. Task<List<T>> GetAllAsync(CancellationToken token);
  16. DataTable GetDataTable(string sql, List<SugarParameter> parameters = null);
  17. }
  18. public interface IBaseRepository<T> where T : Entity, new()
  19. {
  20. SqlSugarClient db { get; }
  21. ISugarQueryable<T> Queryable();
  22. T GetById(int id);
  23. Task<List<T>> GetAllAsync(CancellationToken token);
  24. Task<string> InsertAsync(T entity, CancellationToken token);
  25. string InsertBulk(T entity, bool isEnd);
  26. void Update(T entity);
  27. IUpdateable<T> Updateable();
  28. Task<int> ExecuteSqlAsync(string sql);
  29. DataTable GetDataTable(string sql);
  30. }