protected TR ExecuteScalar <TR>(string sql, object param = null, IDbTransaction transaction = null, int?commandTimeout = null, CommandType?commandType = null) { if (Ado.CommitState) { return(Ado._DbConnection.ExecuteScalar <TR>(sql, param, transaction, commandTimeout, commandType)); } using (var conn = Ado.GetDbConnection()) return(conn.ExecuteScalar <TR>(sql, param, transaction, commandTimeout, commandType)); }
protected async Task <int> ExecuteAsync(string sql, object param = null, IDbTransaction transaction = null, int?commandTimeout = null, CommandType?commandType = null) { if (Ado.CommitState) { return(await Ado._DbConnection.ExecuteAsync(sql, param, transaction, commandTimeout, commandType)); } using (var conn = Ado.GetDbConnection()) return(await conn.ExecuteAsync(sql, param, transaction, commandTimeout, commandType)); }