using MySqlConnector; using System.Data; using System.Linq.Expressions; namespace Cowain.Base.IServices { public interface IBaseService { int Delete(int Id) where T : class; int Delete(T t) where T : class; Task DeleteAsync(int Id, CancellationToken cancellationToken = default) where T : class; Task DeleteAsync(T t, CancellationToken cancellationToken = default) where T : class; int ExecuteByDapper(string sql, object? param = null); Task ExecuteByDapperAsync(string sql, object? param = null, CancellationToken cancellationToken = default); List Find() where T : class; T? Find(int id) where T : class; Task> FindAsync(CancellationToken cancellationToken = default) where T : class; Task FindAsync(int id, CancellationToken cancellationToken = default) where T : class; Task FirstOrDefaultAsync(Expression> funcWhere, CancellationToken cancellationToken = default) where T : class; DataTable GetDataTable(string sql, IEnumerable? parameters = null); Task GetDataTableAsync(string sql, IEnumerable? parameters = null, CancellationToken cancellationToken = default); int Insert(IEnumerable tList) where T : class; int Insert(T t) where T : class; Task InsertAsync(IEnumerable tList, CancellationToken cancellationToken = default) where T : class; Task InsertAsync(T t, CancellationToken cancellationToken = default) where T : class; List Query(Expression>? funcWhere = null) where T : class; Task<(List Data, int TotalCount)> QueryAsync(Expression> selectExpression, Expression>? funcWhere = null, Expression>? orderBy = null, bool isAscending = true, int pageIndex = 1, int pageSize = 20, CancellationToken cancellationToken = default) where T : class; Task<(List Data, int TotalCount)> QueryAsync(Expression>? funcWhere = null, Expression>? orderBy = null, bool isAscending = true, int pageIndex = 1, int pageSize = 20, CancellationToken cancellationToken = default) where T : class; Task> QueryAsync(Expression>? funcWhere = null, CancellationToken cancellationToken = default) where T : class; IEnumerable QueryByDapper(string sql, object? param = null); Task> QueryByDapperAsync(string sql, object? param = null, CancellationToken cancellationToken = default); T? QueryFirstOrDefaultByDapper(string sql, object? param = null); Task QueryFirstOrDefaultByDapperAsync(string sql, object? param = null, CancellationToken cancellationToken = default); DataTable QueryToDataTableByDapper(string sql, object? param = null); Task QueryToDataTableByDapperAsync(string sql, object? param = null, CancellationToken cancellationToken = default); int Update(IEnumerable tList) where T : class; int Update(T t) where T : class; Task UpdateAsync(IEnumerable tList, CancellationToken cancellationToken = default) where T : class; Task UpdateAsync(T t, CancellationToken cancellationToken = default) where T : class; } }