纽威
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

128 lines
7.7 KiB

3 years ago
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Data;
  5. using System.Data.Common;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. namespace NFine.Repository
  10. {
  11. public interface IDatabase : IDisposable
  12. {
  13. bool inTransaction { get; set; }
  14. DbTransaction BeginTrans();
  15. void Commit();
  16. void Rollback();
  17. void Close();
  18. bool BulkInsert(DataTable dt);
  19. int ExecuteBySql(StringBuilder strSql);
  20. int ExecuteBySql(StringBuilder strSql, DbTransaction isOpenTrans);
  21. int ExecuteBySql(StringBuilder strSql, DbParameter[] parameters);
  22. int ExecuteBySql(StringBuilder strSql, DbParameter[] parameters, DbTransaction isOpenTrans);
  23. int ExecuteByProc(string procName);
  24. int ExecuteByProc(string procName, DbTransaction isOpenTrans);
  25. int ExecuteByProc(string procName, DbParameter[] parameters);
  26. int ExecuteByProc(string procName, DbParameter[] parameters, DbTransaction isOpenTrans);
  27. int Insert<T>(T entity);
  28. int Insert<T>(T entity, DbTransaction isOpenTrans);
  29. int Insert<T>(List<T> entity);
  30. int Insert<T>(List<T> entity, DbTransaction isOpenTrans);
  31. int Insert(string tableName, Hashtable ht);
  32. int Insert(string tableName, Hashtable ht, DbTransaction isOpenTrans);
  33. int Update<T>(T entity);
  34. int Update<T>(T entity, DbTransaction isOpenTrans);
  35. int Update<T>(string propertyName, string propertyValue);
  36. int Update<T>(string propertyName, string propertyValue, DbTransaction isOpenTrans);
  37. int Update<T>(List<T> entity);
  38. int Update<T>(List<T> entity, DbTransaction isOpenTrans);
  39. int Update(string tableName, Hashtable ht, string propertyName);
  40. int Update(string tableName, Hashtable ht, string propertyName, DbTransaction isOpenTrans);
  41. int Delete<T>(T entity);
  42. int Delete<T>(T entity, DbTransaction isOpenTrans);
  43. int Delete<T>(object propertyValue);
  44. int Delete<T>(object propertyValue, DbTransaction isOpenTrans);
  45. int Delete<T>(string propertyName, string propertyValue);
  46. int Delete<T>(string propertyName, string propertyValue, DbTransaction isOpenTrans);
  47. int Delete(string tableName, string propertyName, string propertyValue);
  48. int Delete(string tableName, string propertyName, string propertyValue, DbTransaction isOpenTrans);
  49. int Delete(string tableName, Hashtable ht);
  50. int Delete(string tableName, Hashtable ht, DbTransaction isOpenTrans);
  51. int Delete<T>(object[] propertyValue);
  52. int Delete<T>(object[] propertyValue, DbTransaction isOpenTrans);
  53. int Delete<T>(string propertyName, object[] propertyValue);
  54. int Delete<T>(string propertyName, object[] propertyValue, DbTransaction isOpenTrans);
  55. int Delete(string tableName, string propertyName, object[] propertyValue);
  56. int Delete(string tableName, string propertyName, object[] propertyValue, DbTransaction isOpenTrans);
  57. List<T> FindListTop<T>(int Top) where T : new();
  58. List<T> FindListTop<T>(int Top, string propertyName, string propertyValue) where T : new();
  59. List<T> FindListTop<T>(int Top, string WhereSql) where T : new();
  60. List<T> FindListTop<T>(int Top, string WhereSql, DbParameter[] parameters) where T : new();
  61. List<T> FindList<T>() where T : new();
  62. List<T> FindList<T>(string propertyName, string propertyValue) where T : new();
  63. List<T> FindList<T>(string WhereSql) where T : new();
  64. List<T> FindList<T>(string WhereSql, DbParameter[] parameters) where T : new();
  65. List<T> FindListBySql<T>(string strSql);
  66. List<T> FindListBySql<T>(string strSql, DbParameter[] parameters);
  67. List<T> FindListPage<T>(string orderField, string orderType, int pageIndex, int pageSize, ref int recordCount) where T : new();
  68. List<T> FindListPage<T>(string WhereSql, string orderField, string orderType, int pageIndex, int pageSize, ref int recordCount) where T : new();
  69. List<T> FindListPage<T>(string WhereSql, DbParameter[] parameters, string orderField, string orderType, int pageIndex, int pageSize, ref int recordCount) where T : new();
  70. List<T> FindListPageBySql<T>(string strSql, string orderField, string orderType, int pageIndex, int pageSize, ref int recordCount);
  71. List<T> FindListPageBySql<T>(string strSql, DbParameter[] parameters, string orderField, string orderType, int pageIndex, int pageSize, ref int recordCount);
  72. DataTable FindTableTop<T>(int Top) where T : new();
  73. DataTable FindTableTop<T>(int Top, string WhereSql) where T : new();
  74. DataTable FindTableTop<T>(int Top, string WhereSql, DbParameter[] parameters) where T : new();
  75. DataTable FindTable<T>() where T : new();
  76. DataTable FindTable<T>(string WhereSql) where T : new();
  77. DataTable FindTable<T>(string WhereSql, DbParameter[] parameters) where T : new();
  78. DataTable FindTableBySql(string strSql);
  79. DataTable FindTableBySql(string strSql, DbParameter[] parameters);
  80. DataTable FindTablePage<T>(string orderField, string orderType, int pageIndex, int pageSize, ref int recordCount) where T : new();
  81. DataTable FindTablePage<T>(string WhereSql, string orderField, string orderType, int pageIndex, int pageSize, ref int recordCount) where T : new();
  82. DataTable FindTablePage<T>(string WhereSql, DbParameter[] parameters, string orderField, string orderType, int pageIndex, int pageSize, ref int recordCount) where T : new();
  83. DataTable FindTablePageBySql(string strSql, string orderField, string orderType, int pageIndex, int pageSize, ref int recordCount);
  84. DataTable FindTablePageBySql(string strSql, DbParameter[] parameters, string orderField, string orderType, int pageIndex, int pageSize, ref int recordCount);
  85. DataTable FindTableByProc(string procName);
  86. DataTable FindTableByProc(string procName, DbParameter[] parameters);
  87. DataSet FindDataSetBySql(string strSql);
  88. DataSet FindDataSetBySql(string strSql, DbParameter[] parameters);
  89. DataSet FindDataSetByProc(string procName);
  90. DataSet FindDataSetByProc(string procName, DbParameter[] parameters);
  91. T FindEntity<T>(object propertyValue) where T : new();
  92. T FindEntity<T>(string propertyName, object propertyValue) where T : new();
  93. T FindEntityByWhere<T>(string WhereSql) where T : new();
  94. T FindEntityByWhere<T>(string WhereSql, DbParameter[] parameters) where T : new();
  95. T FindEntityBySql<T>(string strSql);
  96. T FindEntityBySql<T>(string strSql, DbParameter[] parameters);
  97. Hashtable FindHashtable(string tableName, string propertyName, object propertyValue);
  98. Hashtable FindHashtable(string tableName, StringBuilder WhereSql);
  99. Hashtable FindHashtable(string tableName, StringBuilder WhereSql, DbParameter[] parameters);
  100. Hashtable FindHashtableBySql(string strSql);
  101. Hashtable FindHashtableBySql(string strSql, DbParameter[] parameters);
  102. int FindCount<T>() where T : new();
  103. int FindCount<T>(string propertyName, string propertyValue) where T : new();
  104. int FindCount<T>(string WhereSql) where T : new();
  105. int FindCount<T>(string WhereSql, DbParameter[] parameters) where T : new();
  106. int FindCountBySql(string strSql);
  107. int FindCountBySql(string strSql, DbParameter[] parameters);
  108. object FindMax<T>(string propertyName) where T : new();
  109. object FindMax<T>(string propertyName, string WhereSql) where T : new();
  110. object FindMax<T>(string propertyName, string WhereSql, DbParameter[] parameters) where T : new();
  111. object FindMaxBySql(string strSql);
  112. object FindMaxBySql(string strSql, DbParameter[] parameters);
  113. }
  114. }