using NFine.Code; using System; using System.Collections; using System.Collections.Generic; using System.Data; using System.Data.Common; using System.Linq; using System.Text; using System.Threading.Tasks; namespace NFine.Repository { public interface IRepository where T : new() { #region 事务 /// /// 事务开始 /// /// DbTransaction BeginTrans(); /// /// 提交事务 /// void Commit(); /// /// 回滚事务 /// void Rollback(); /// /// 关闭数据库连接 /// void Close(); #endregion #region SqlBulkCopy大批量数据插入 /// /// 大批量数据插入 /// /// 资料表 /// bool BulkInsert(DataTable datatable); #endregion #region 执行SQL语句 /// /// 执行SQL语句 /// /// Sql语句 /// int ExecuteBySql(StringBuilder strSql); /// /// 执行SQL语句 /// /// Sql语句 /// 事务对象 /// int ExecuteBySql(StringBuilder strSql, DbTransaction isOpenTrans); /// /// 执行SQL语句 /// /// Sql语句 /// sql语句对应参数 /// int ExecuteBySql(StringBuilder strSql, DbParameter[] parameters); /// /// 执行SQL语句 /// /// Sql语句 /// sql语句对应参数 /// 事务对象 /// int ExecuteBySql(StringBuilder strSql, DbParameter[] parameters, DbTransaction isOpenTrans); #endregion #region 执行存储过程 /// /// 执行存储过程 /// /// 存储过程 /// int ExecuteByProc(string procName); /// /// 执行存储过程 /// /// 存储过程 /// 事务对象 /// int ExecuteByProc(string procName, DbTransaction isOpenTrans); /// /// 执行存储过程 /// /// 存储过程 /// sql语句对应参数 /// int ExecuteByProc(string procName, DbParameter[] parameters); /// /// 执行存储过程 /// /// 存储过程 /// sql语句对应参数 /// 事务对象 /// int ExecuteByProc(string procName, DbParameter[] parameters, DbTransaction isOpenTrans); #endregion #region 插入数据 /// /// 插入数据 /// /// 实体类对象 /// int Insert(T entity); /// /// 插入数据 /// /// 实体类对象 /// 事务对象 /// int Insert(T entity, DbTransaction isOpenTrans); /// /// 批量插入数据 /// /// 实体类对象 /// int Insert(List entity); /// /// 批量插入数据 /// /// 实体类对象 /// 事务对象 /// int Insert(List entity, DbTransaction isOpenTrans); #endregion #region 修改数据 /// /// 修改数据 /// /// 实体对象 /// int Update(T entity); /// /// 修改数据 /// /// 实体对象 /// 事务对象 /// int Update(T entity, DbTransaction isOpenTrans); /// /// 修改数据 /// /// 实体属性名称 /// 字段值 /// int Update(string propertyName, string propertyValue); /// /// 修改数据 /// /// 实体属性名称 /// 字段值 /// 事务对象 /// int Update(string propertyName, string propertyValue, DbTransaction isOpenTrans); /// /// 批量修改数据 /// /// 实体对象 /// int Update(List entity); /// /// 批量修改数据 /// /// 实体对象 /// 事务对象 /// int Update(List entity, DbTransaction isOpenTrans); #endregion #region 删除数据 /// /// 删除数据 /// /// 实体类 /// int Delete(T entity); /// /// 删除数据 /// /// 实体类 /// 事务对象 /// int Delete(T entity, DbTransaction isOpenTrans); /// /// 删除数据 /// /// 主键值 /// int Delete(object propertyValue); /// /// 删除数据 /// /// 主键值 /// 事务对象 /// int Delete(object propertyValue, DbTransaction isOpenTrans); /// /// 删除数据 /// /// 实体属性名称 /// 字段值 /// int Delete(string propertyName, string propertyValue); /// /// 删除数据 /// /// 实体属性名称 /// 字段值 /// 事务对象 /// int Delete(string propertyName, string propertyValue, DbTransaction isOpenTrans); /// /// 删除数据 /// /// 表名 /// 键值生成SQL条件 /// int Delete(string tableName, Hashtable ht); /// /// 删除数据 /// /// 表名 /// 键值生成SQL条件 /// 事务对象 /// int Delete(string tableName, Hashtable ht, DbTransaction isOpenTrans); /// /// 批量删除数据 /// /// 主键值:数组1,2,3,4,5,6..... /// int Delete(object[] propertyValue); /// /// 批量删除数据 /// /// 主键值:数组1,2,3,4,5,6..... /// 事务对象 /// int Delete(object[] propertyValue, DbTransaction isOpenTrans); /// /// 批量删除数据 /// /// 实体属性名称 /// 字段值:数组1,2,3,4,5,6..... /// int Delete(string propertyName, object[] propertyValue); /// /// 批量删除数据 /// /// 实体属性名称 /// 字段值:数组1,2,3,4,5,6..... /// 事务对象 /// int Delete(string propertyName, object[] propertyValue, DbTransaction isOpenTrans); #endregion #region 查询数据列表、返回List /// /// 查询数据列表、返回List /// /// 显示条数 /// List FindListTop(int Top); /// /// 查询数据列表、返回List /// /// 显示条数 /// 实体属性名称 /// 字段值 /// List FindListTop(int Top, string propertyName, string propertyValue); /// /// 查询数据列表、返回List /// /// 显示条数 /// 条件 /// List FindListTop(int Top, string WhereSql); /// /// 查询数据列表、返回List /// /// 显示条数 /// 条件 /// sql语句对应参数 /// List FindListTop(int Top, string WhereSql, DbParameter[] parameters); /// /// 查询数据列表、返回List /// /// List FindList(); /// /// 查询数据列表、返回List /// /// 实体属性名称 /// 字段值 /// List FindList(string propertyName, string propertyValue); /// /// 查询数据列表、返回List /// /// 条件 /// List FindList(string WhereSql); /// /// 查询数据列表、返回List /// /// 条件 /// sql语句对应参数 /// List FindList(string WhereSql, DbParameter[] parameters); /// /// 查询数据列表、返回List /// /// Sql语句 /// List FindListBySql(string strSql); /// /// 查询数据列表、返回List /// /// Sql语句 /// sql语句对应参数 /// List FindListBySql(string strSql, DbParameter[] parameters); /// /// 查询数据列表、返回List /// /// 分页参数 /// List FindListPage(ref Pagination Pagination); /// /// 查询数据列表、返回List /// /// 条件 /// 分页参数 /// List FindListPage(string WhereSql, ref Pagination Pagination); /// /// 查询数据列表、返回List /// /// 条件 /// sql语句对应参数 /// 分页参数 /// List FindListPage(string WhereSql, DbParameter[] parameters, ref Pagination Pagination); /// /// 查询数据列表、返回List /// /// Sql语句 /// 分页参数 /// List FindListPageBySql(string strSql, ref Pagination Pagination); /// /// 查询数据列表、返回List /// /// Sql语句 /// 分页参数 /// List FindListPageBySql(string strSql, DbParameter[] parameters, ref Pagination Pagination); #endregion #region 查询数据列表、返回DataTable /// /// 查询数据列表、返回 DataTable /// /// 显示条数 /// DataTable FindTableTop(int Top); /// /// 查询数据列表、返回 DataTable /// /// 显示条数 /// 条件 /// DataTable FindTableTop(int Top, string WhereSql); /// /// 查询数据列表、返回 DataTable /// /// 显示条数 /// 条件 /// sql语句对应参数 /// DataTable FindTableTop(int Top, string WhereSql, DbParameter[] parameters); /// /// 查询数据列表、返回 DataTable /// /// DataTable FindTable(); /// /// 查询数据列表、返回 DataTable /// /// 条件 /// DataTable FindTable(string WhereSql); /// /// 查询数据列表、返回 DataTable /// /// 条件 /// sql语句对应参数 /// DataTable FindTable(string WhereSql, DbParameter[] parameters); /// /// 查询数据列表、返回 DataTable /// /// Sql语句 /// DataTable FindTableBySql(string strSql); /// /// 查询数据列表、返回 DataTable /// /// Sql语句 /// sql语句对应参数 /// DataTable FindTableBySql(string strSql, DbParameter[] parameters); /// /// 查询数据列表、返回 DataTable /// /// 排序字段 /// 排序类型 /// 当前页 /// 页大小 /// 返回查询条数 /// DataTable FindTablePage(ref Pagination Pagination); /// /// 查询数据列表、返回 DataTable /// /// 条件 /// 分页参数 /// DataTable FindTablePage(string WhereSql, ref Pagination Pagination); /// /// 查询数据列表、返回 DataTable /// /// 条件 /// sql语句对应参数 /// 分页参数 /// DataTable FindTablePage(string WhereSql, DbParameter[] parameters, ref Pagination Pagination); /// /// 查询数据列表、返回 DataTable /// /// Sql语句 /// 分页参数 /// DataTable FindTablePageBySql(string strSql, ref Pagination Pagination); /// /// 查询数据列表、返回 DataTable /// /// Sql语句 /// sql语句对应参数 /// 分页参数 /// DataTable FindTablePageBySql(string strSql, DbParameter[] parameters, ref Pagination Pagination); /// /// 查询数据列表、返回 DataTable /// /// 存储过程 /// DataTable FindTableByProc(string procName); /// /// 查询数据列表、返回 DataTable /// /// 存储过程 /// sql语句对应参数 /// DataTable FindTableByProc(string procName, DbParameter[] parameters); #endregion #region 查询数据列表、返回DataSet /// /// 查询数据列表、返回DataSet /// /// Sql语句 /// DataSet FindDataSetBySql(string strSql); /// /// 查询数据列表、返回DataSet /// /// Sql语句 /// sql语句对应参数 /// DataSet FindDataSetBySql(string strSql, DbParameter[] parameters); /// /// 查询数据列表、返回DataSet /// /// 存储过程 /// DataSet FindDataSetByProc(string procName); /// /// 查询数据列表、返回DataSet /// /// 存储过程 /// sql语句对应参数 /// DataSet FindDataSetByProc(string procName, DbParameter[] parameters); #endregion #region 查询对象、返回实体 /// /// 查询对象、返回实体 /// /// 主键值 /// T FindEntity(object propertyValue); /// /// 查询对象、返回实体 /// /// 实体属性名称 /// 字段值 /// T FindEntity(string propertyName, object propertyValue); /// /// 查询对象、返回实体 /// /// 条件 /// T FindEntityByWhere(string WhereSql); /// /// 查询对象、返回实体 /// /// 条件 /// sql语句对应参数 /// T FindEntityByWhere(string WhereSql, DbParameter[] parameters); /// /// 查询对象、返回实体 /// /// Sql语句 /// T FindEntityBySql(string strSql); /// /// 查询对象、返回实体 /// /// Sql语句 /// sql语句对应参数 /// T FindEntityBySql(string strSql, DbParameter[] parameters); #endregion #region 查询数据、返回条数 /// /// 查询数据、返回条数 /// /// int FindCount(); /// /// 查询数据、返回条数 /// 实体属性名称 /// 字段值 /// /// int FindCount(string propertyName, string propertyValue); /// /// 查询数据、返回条数 /// /// 条件 /// int FindCount(string WhereSql); /// /// 查询数据、返回条数 /// /// 条件 /// sql语句对应参数 /// int FindCount(string WhereSql, DbParameter[] parameters); /// /// 查询数据、返回条数 /// /// Sql语句 /// int FindCountBySql(string strSql); /// /// 查询数据、返回条数 /// /// Sql语句 /// sql语句对应参数 /// int FindCountBySql(string strSql, DbParameter[] parameters); #endregion #region 查询数据、返回最大数 /// /// 查询数据、返回最大数 /// /// 实体属性名称 /// object FindMax(string propertyName); /// /// 查询数据、返回最大数 /// /// 实体属性名称 /// 条件 /// object FindMax(string propertyName, string WhereSql); /// /// 查询数据、返回最大数 /// /// 实体属性名称 /// 条件 /// sql语句对应参数 /// object FindMax(string propertyName, string WhereSql, DbParameter[] parameters); /// /// 查询数据、返回最大数 /// /// Sql语句 /// object FindMaxBySql(string strSql); /// /// 查询数据、返回最大数 /// /// Sql语句 /// sql语句对应参数 /// object FindMaxBySql(string strSql, DbParameter[] parameters); #endregion } }