Beispiel #1
0
 /// <summary>
 /// 执行选择单个值的参数化SQL。
 /// </summary>
 /// <param name="sql"></param>
 /// <param name="parameters"></param>
 /// <param name="commandType"></param>
 /// <returns></returns>
 public int Execute(string sql, DynamicParameters parameters = null, CommandType?commandType = null)
 {
     if (CurrentTransaction != null)
     {
         return(DbExecProxy <int>((param) => CurrentConnection.Execute(sql, param, CurrentTransaction, null, commandType), sql, parameters));
     }
     else
     {
         using var connection = GetDbConnection(DataSourceEnum.MASTER);
         return(DbExecProxy <int>((param) => connection.Execute(sql, param, CurrentTransaction, null, commandType), sql, parameters));
     }
 }