Пример #1
0
 /// <summary>
 /// 删除单条数据
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="dicParam"></param>
 /// <param name="DbConnectStr"></param>
 /// <returns></returns>
 public int DeleteSigerData <T>(Dictionary <string, Object> dicParam, string DbConnectStr = "")
 {
     if (DbConnectStr == "")
     {
         return(DapperHelper.CreateInstance(BaseApplication.DefaultSqlConnectionKey).DeleteSigerData <T>(dicParam));
     }
     else
     {
         return(DapperHelper.CreateInstance(DbConnectStr).DeleteSigerData <T>(dicParam));
     }
 }
Пример #2
0
 /// <summary>
 /// 批量插入数据
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="dataList"></param>
 /// <returns></returns>
 public int InsertBatch <T>(object dataList, string DbConnectStr = "")
 {
     if (DbConnectStr == "")
     {
         return(DapperHelper.CreateInstance(BaseApplication.DefaultSqlConnectionKey).InsertBatch <T>(typeof(T).Name, (List <T>)dataList));
     }
     else
     {
         return(DapperHelper.CreateInstance(DbConnectStr).InsertBatch <T>(typeof(T).Name, (List <T>)dataList));
     }
 }
Пример #3
0
 /// <summary>
 /// 简单查询
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="sql"></param>
 /// <param name="DbConnectStr"></param>
 /// <returns></returns>
 public List <T> SelectData <T>(string sql, string DbConnectStr = "")
 {
     if (DbConnectStr == "")
     {
         return(DapperHelper.CreateInstance(BaseApplication.DefaultSqlConnectionKey).SimpleQuery <T>(sql));
     }
     else
     {
         return(DapperHelper.CreateInstance(DbConnectStr).SimpleQuery <T>(sql));
     }
 }
Пример #4
0
 /// <summary>
 /// 分页查询
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="PageSize"></param>
 /// <param name="PageIndex"></param>
 /// <param name="OrderBy"></param>
 /// <param name="TotalCount"></param>
 /// <param name="sql"></param>
 /// <param name="whereObj"></param>
 /// <param name="DbConnectStr"></param>
 /// <returns></returns>
 public List <T> SimplePageQuery <T>(int PageSize, int PageIndex, String OrderBy, out int TotalCount, string sql, object whereObj = null, string DbConnectStr = "")
 {
     if (DbConnectStr == "")
     {
         return(DapperHelper.CreateInstance(BaseApplication.DefaultSqlConnectionKey).SimplePageQuery <T>(PageSize, PageIndex, OrderBy, out TotalCount, sql, whereObj));
     }
     else
     {
         return(DapperHelper.CreateInstance(DbConnectStr).SimplePageQuery <T>(PageSize, PageIndex, OrderBy, out TotalCount, sql, whereObj));
     }
 }
Пример #5
0
 /// <summary>
 /// 跟新数据
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="Param"></param>
 /// <param name="dataList"></param>
 /// <param name="DbConnectStr"></param>
 /// <returns></returns>
 public int UpdateTable <T>(object data, Dictionary <string, object> Param = null, string DbConnectStr = "")
 {
     if (DbConnectStr == "")
     {
         return(DapperHelper.CreateInstance(BaseApplication.DefaultSqlConnectionKey).UpdateTable <T>(typeof(T).Name, (T)data, Param));
     }
     else
     {
         return(DapperHelper.CreateInstance(DbConnectStr).UpdateTable <T>(typeof(T).Name, (T)data, Param));
     }
 }
Пример #6
0
 public int InsertTable(string FiledsName, object arrayList)
 {
     return(DapperHelper.CreateInstance(BaseApplication.DefaultSqlConnectionKey).InsertBatch("PrimaryKeyTest", FiledsName, arrayList));
 }
Пример #7
0
 public List <Users> SimpleQuery(string sql, object whereObj)
 {
     return(DapperHelper.CreateInstance(BaseApplication.DefaultSqlConnectionKey).SimpleQuery <Users>(sql, whereObj));
 }