using Dapper;
using System.Collections.Generic;
using System.Data;
using System.Threading.Tasks;
namespace Common.Repository.Interface
{
///
///
///
public interface IDapperDBBase
{
///
///
///
///
IDbConnection GetConn();
///
/// 无参数存储过程
///
/// 存储过程名称
/// 返回值List
List QuerySP(string SPName);
///
/// 有参数存储过程
///
/// 存储过程名称
/// 返回值List
List QuerySP(string SPName, object parms);
///
/// 无参数异步存储过程
///
/// 存储过程名称
/// 返回值List
Task> QuerySPAsync(string SPName);
///
/// 无参数异步存储过程
///
/// 存储过程名称
/// 返回值List
Task> QuerySPAsync(string SPName, object parms);
///
///
///
///
///
///
Task ExecSPTransAsync(string SPName, object parms);
///
///
///
///
///
///
///
///
Task ExecSPTransAsync(string SPName, object parms, IDbConnection conn, IDbTransaction tran);
///
///
///
///
///
///
Task ExecSPAsync(string SPName, object parms);
///
///
///
///
///
///
///
Task QueryDataSetAsync(string Sql, object parms, CommandType commandType);
///
///
///
///
///
///
Task InsertAsync(string insertSql, object parms);
///
///
///
///
///
///
Task UpdateAsync(string updateSql, object parms);
///
///
///
///
///
///
Task DeleteAsync(int Id, string deleteSql);
///
///
///
///
///
///
Task> SelectAsync(string selectSql);
///
///
///
///
///
///
///
Task DetailFirstAsync(int Id, string detailSql);
//以下为dapper扩展方法,根据实体模型进行CRUD操作
///
///
///
///
///
///
Task QueryOneAsync(int id) where T : class;
///
///
///
///
///
Task> QueryAllAsync() where T : class;
///
///
///
///
///
///
Task InsertByEntitysAsync(IEnumerable entitys) where T : class;
///
///
///
///
///
///
Task InsertByEntityAsync(T entity) where T : class;
///
///
///
///
///
///
Task UpdateByEntitysAsync(IEnumerable entitys) where T : class;
///
///
///
///
///
///
Task UpdateByEntityAsync(T entity) where T : class;
///
///
///
///
///
///
Task DeleteByEntitysAsync(IEnumerable entitys) where T : class;
///
///
///
///
///
///
Task DeleteByEntityAsync(T entity) where T : class;
///
///
///
///
///
///
///
Task QuerySingleOrDefaultAsync(string sql, object parms);
///
/// 默认返回第一条数据
///
/// 返回类型
/// 查询语句
///
Task QueryFirstOrDefaultAsync(string sql);
///
///
///
///
///
Task QueryToDatableAsync(string querySQL);
///
///
///
///
///
Task QueryToDatableAsync(string querySQL, DynamicParameters parms);
///
/// 执行SQL语句返回结果
///
///
///
///
Task ExecuteScalarAsync(string Sql, object parms);
///
/// 执行中包含事务sql
///
///
///
Task ExecSqlTransAsync(List listSql);
}
}