1. 项目引用Dapper作为直接访问, 为了使用方便, 封装一下.达到效果: - 数据库连接配置在webconfig.xml中. - 常用调用方法封装. 调用: //可以采用单例模式.
//全局实例
public static DapperEntity DBI
{
get
{
return DapperEntity.Instance;
}
}
//调用
public static DateTime GetDBDateTime()
{
return DBI.QueryFirst("SELECT GETDATE()");
}
参考单例:
private static object syncObj = new object();
private static DapperEntity instance;
public static DapperEntity Instance
{
get
{
if (instance == null)
{
lock (syncObj)
{
if (instance == null)
{
instance = DapperEntity.Instance
}
}
}
return instance;
}
}
封装类:
//配置在webconfig.xml中
public class DapperEntity
{
private static DapperEntity instance;
private string ConnectionString;
private IDbConnection DefineConnection;
private IDbConnection DefaultConnection;
private IDbTransaction Transaction;
public static DapperEntity Instance
{
get
{
return new DapperEntity("");
}
}
public IDbConnection Connection
{
get
{
IDbConnection result;
if (this.DefineConnection != null)
{
result = this.DefineConnection;
}
else
{
if (this.DefaultConnection == null)
{
this.DefaultConnection = new SqlConnection(this.ConnectionString);
}
result = this.DefaultConnection;
}
return result;
}
}
public DapperEntity(string connectionStr = "")
{
if (string.IsNullOrEmpty(connectionStr))
{
connectionStr = ConfigurationManager.ConnectionStrings["TSQLDBConnectionString"].ConnectionString;
}
this.ConnectionString = connectionStr;
}
public DapperEntity(IDbConnection connection)
{
this.DefineConnection = connection;
}
public DataBaseType GetDataBaseType()
{
string name = this.Connection.GetType().Name;
string text = name;
DataBaseType result;
if (text != null)
{
if (text == "SQLiteConnection")
{
result = DataBaseType.SQLiteConnection;
return result;
}
if (!(text == "SqlConnection"))
{
}
}
result = DataBaseType.SqlConnection;
return result;
}
}
完整包括方法如下:
public class DapperEntity
{
private static DapperEntity instance;
private string ConnectionString;
private IDbConnection DefineConnection;
private IDbConnection DefaultConnection;
private IDbTransaction Transaction;
public static DapperEntity Instance
{
get
{
return new DapperEntity("");
}
}
public IDbConnection Connection
{
get
{
IDbConnection result;
if (this.DefineConnection != null)
{
result = this.DefineConnection;
}
else
{
if (this.DefaultConnection == null)
{
this.DefaultConnection = new SqlConnection(this.ConnectionString);
}
result = this.DefaultConnection;
}
return result;
}
}
public DapperEntity(string connectionStr = "")
{
if (string.IsNullOrEmpty(connectionStr))
{
connectionStr = ConfigurationManager.ConnectionStrings["TSQLDBConnectionString"].ConnectionString;
}
this.ConnectionString = connectionStr;
}
public DapperEntity(IDbConnection connection)
{
this.DefineConnection = connection;
}
public DataBaseType GetDataBaseType()
{
string name = this.Connection.GetType().Name;
string text = name;
DataBaseType result;
if (text != null)
{
if (text == "SQLiteConnection")
{
result = DataBaseType.SQLiteConnection;
return result;
}
if (!(text == "SqlConnection"))
{
}
}
result = DataBaseType.SqlConnection;
return result;
}
public object GetArrayFirst(object param)
{
object result;
if (param.GetType().BaseType.Name == "Array")
{
object[] array = param as object[];
if (array.Length == 0)
{
throw new Exception("数组不能为空");
}
result = array[0];
}
else
{
result = null;
}
return result;
}
private string BindQueryPageSql(string sql, PageQueryParams pqp)
{
int num = (pqp.PageIndex - 1) * pqp.PageSize;
int num2 = num + pqp.PageSize;
return string.Concat(new object[]
{
"select * from (select row_number()over(order by ",
pqp.OrderField,
" ",
pqp.OrderDirection.ToString(),
")rownumber,* from (",
sql,
")t1)t2 WHERE rownumber>",
num,
" and rownumber<=",
num2
});
}
public PageQueryModel OQueryPage(PageQueryParams pageQueryParams, string sql, object param = null, IDbTransaction transaction = null, bool buffered = true, int? commandTimeout = null, CommandType? commandType = null)
{
int total = Convert.ToInt32(this.Connection.ExecuteScalar("select count(*) from (" + sql + ")a", param, transaction, commandTimeout, commandType));
sql = this.BindQueryPageSql(sql, pageQueryParams);
return new PageQueryModel
{
Total = total,
Data = this.Connection.Query(sql, param, transaction, buffered, commandTimeout, commandType)
};
}
[return: Dynamic(new bool[]
{
false,
true
})]
public PageQueryModel OQueryPage(PageQueryParams pageQueryParams, string sql, object param = null, IDbTransaction transaction = null, bool buffered = true, int? commandTimeout = null, CommandType? commandType = null)
{
int total = Convert.ToInt32(this.Connection.ExecuteScalar("select count(*) from (" + sql + ")a", param, transaction, commandTimeout, commandType));
sql = this.BindQueryPageSql(sql, pageQueryParams);
return new PageQueryModel
{
Total = total,
Data = this.Connection.Query(sql, param, transaction, buffered, commandTimeout, commandType)
};
}
[return: Dynamic]
public dynamic OQueryFirstByPrimaryKey(object param, string tableName = null, string primaryKey = null, IDbTransaction transaction = null, int? commandTimeout = null)
{
ObjectParser objectParser = ObjectParser.Bulid(param, tableName, primaryKey, true);
return this.QueryFirstOrDefault(string.Concat(new string[]
{
"select * from ",
objectParser.TableName,
" where ",
objectParser.PrimaryPropertyInfo.Name,
"=@",
objectParser.PrimaryPropertyInfo.Name
}), param, transaction, commandTimeout, null);
}
public T OQueryFirstByPrimaryKey(object param, string primaryKey = null, IDbTransaction transaction = null, int? commandTimeout = null)
{
ObjectParser objectParser = ObjectParser.Bulid(param, primaryKey, true);
return this.QueryFirstOrDefault(string.Concat(new string[]
{
"select * from ",
objectParser.TableName,
" where ",
objectParser.PrimaryPropertyInfo.Name,
"=@",
objectParser.PrimaryPropertyInfo.Name
}), param, transaction, commandTimeout, null);
}
[return: Dynamic(new bool[]
{
false,
true
})]
public IEnumerable OQuery(object param, string where = null, string tableName = null, IDbTransaction transaction = null)
{
ObjectParser objectParser = ObjectParser.Bulid(param, tableName, null, false);
return this.Query("select * from " + objectParser.TableName + ((!string.IsNullOrEmpty(where)) ? (" where " + where) : ""), param, transaction, true, null, null);
}
public IEnumerable OQuery(object param, string where = null, IDbTransaction transaction = null, int? commandTimeout = null)
{
ObjectParser objectParser = ObjectParser.Bulid(param, null, false);
return this.Query("select * from " + objectParser.TableName + ((!string.IsNullOrEmpty(where)) ? (" where " + where) : ""), param, transaction, true, null, null);
}
[return: Dynamic]
public dynamic OQueryFirstOrDefault(object param, string where = null, string tableName = null, IDbTransaction transaction = null)
{
ObjectParser objectParser = ObjectParser.Bulid(param, tableName, null, false);
return this.QueryFirstOrDefault("select * from " + objectParser.TableName + ((!string.IsNullOrEmpty(where)) ? (" where " + where) : ""), param, transaction, null, null);
}
public T OQueryFirstOrDefault(object param, string where = null, IDbTransaction transaction = null, int? commandTimeout = null)
{
ObjectParser objectParser = ObjectParser.Bulid(param, null, false);
return this.QueryFirstOrDefault("select * from " + objectParser.TableName + ((!string.IsNullOrEmpty(where)) ? (" where " + where) : ""), param, transaction, null, null);
}
public void BeginTransaction()
{
this.Connection.Open();
this.Transaction = this.Connection.BeginTransaction();
}
public void CommitTransaction()
{
this.Transaction.Commit();
this.Connection.Close();
}
public void RollbackTransaction()
{
this.Transaction.Rollback();
this.Connection.Close();
}
public int OInsert(object param, string tableName = null, IDbTransaction transaction = null, int? commandTimeout = null)
{
ObjectParser oParser = ObjectParser.Bulid(this.GetArrayFirst(param) ?? param, tableName, null, false);
return this.OInsertHandle(param, transaction ?? this.Transaction, commandTimeout, oParser);
}
public int OInsert(object param, IDbTransaction transaction = null, int? commandTimeout = null)
{
ObjectParser oParser = ObjectParser.Bulid(this.GetArrayFirst(param) ?? param, null, false);
return this.OInsertHandle(param, transaction, commandTimeout, oParser);
}
private int OInsertHandle(object param, IDbTransaction transaction, int? commandTimeout, ObjectParser oParser)
{
return this.Execute(string.Concat(new string[]
{
"insert into ",
oParser.TableName,
"(",
oParser.GetSQL_InsertField(),
") values (",
oParser.GetSQL_InsertValue(),
")"
}), param, transaction, commandTimeout, null);
}
public int OUpdate(object param, string whereSql, object whereParam, string tableName = null, IDbTransaction transaction = null, int? commandTimeout = null)
{
ObjectParser objectParser = ObjectParser.Bulid(param, tableName, null, false);
return this.Execute(string.Concat(new string[]
{
"update ",
objectParser.TableName,
" set ",
objectParser.GetSQL_UpdateFieldValue("", null),
" where ",
whereSql
}), param, transaction, commandTimeout, null);
}
public int OUpdateByPrimaryKey(object param, string tableName = null, string primaryKey = null, IDbTransaction transaction = null, int? commandTimeout = null)
{
ObjectParser oParser = ObjectParser.Bulid(this.GetArrayFirst(param) ?? param, tableName, primaryKey, true);
return this.OUpdateByPrimaryKeyHandle(param, transaction, commandTimeout, oParser);
}
public int OUpdateByPrimaryKey(object param, string primaryKey = null, IDbTransaction transaction = null, int? commandTimeout = null)
{
ObjectParser oParser = ObjectParser.Bulid(this.GetArrayFirst(param) ?? param, primaryKey, true);
return this.OUpdateByPrimaryKeyHandle(param, transaction, commandTimeout, oParser);
}
private int OUpdateByPrimaryKeyHandle(object param, IDbTransaction transaction, int? commandTimeout, ObjectParser oParser)
{
return this.Execute(string.Concat(new string[]
{
"update ",
oParser.TableName,
" set ",
oParser.GetSQL_UpdateFieldValue("", null),
" where ",
oParser.PrimaryPropertyInfo.Name,
"=@",
oParser.PrimaryPropertyInfo.Name
}), param, transaction, commandTimeout, null);
}
public int OUpdate(object param, string where, string tableName = null, IDbTransaction transaction = null, int? commandTimeout = null)
{
ObjectParser oParser = ObjectParser.Bulid(this.GetArrayFirst(param) ?? param, tableName, null, false);
return this.OUpdateHandle(param, where, transaction, commandTimeout, oParser);
}
private int OUpdateHandle(object param, string where, IDbTransaction transaction, int? commandTimeout, ObjectParser oParser)
{
return this.Execute(string.Concat(new string[]
{
"update ",
oParser.TableName,
" set ",
oParser.GetSQL_UpdateFieldValue(where, null),
(!string.IsNullOrEmpty(where)) ? (" where " + where) : ""
}), param, transaction, commandTimeout, null);
}
public int OUpdate(object param, string where, IDbTransaction transaction = null, int? commandTimeout = null)
{
ObjectParser oParser = ObjectParser.Bulid(this.GetArrayFirst(param) ?? param, null, false);
return this.OUpdateHandle(param, where, transaction, commandTimeout, oParser);
}
public int OInsertOrUpdate(object param, string tableName = null, string primaryKey = null, string[] UnUpdateColumns = null, IDbTransaction transaction = null, int? commandTimeout = null)
{
object arrayFirst = this.GetArrayFirst(param);
bool flag = arrayFirst != null;
int result;
if (this.GetDataBaseType() == DataBaseType.SqlConnection)
{
ObjectParser objectParser = ObjectParser.Bulid(arrayFirst ?? param, tableName, primaryKey, true);
result = this.Execute(string.Concat(new string[]
{
"IF Not EXISTS (SELECT * FROM dbo.AppUserConfig WHERE UserID=@UserID) insert into ",
objectParser.TableName,
"(",
objectParser.GetSQL_InsertField(),
") values (",
objectParser.GetSQL_InsertValue(),
")ELSE update ",
objectParser.TableName,
" set ",
objectParser.GetSQL_UpdateFieldValue("", UnUpdateColumns),
" where ",
objectParser.PrimaryPropertyInfo.Name,
"=@",
objectParser.PrimaryPropertyInfo.Name
}), param, transaction, commandTimeout, null);
}
else
{
if (!flag)
{
if (!this.OExistByPrimaryKey(param, tableName, primaryKey, null))
{
result = this.OInsert(param, tableName, transaction, commandTimeout);
}
else
{
result = this.OUpdateByPrimaryKey(param, tableName, primaryKey, transaction, commandTimeout);
}
}
else
{
object[] array = param as object[];
int num = 0;
object[] array2 = array;
for (int i = 0; i < array2.Length; i++)
{
object obj = array2[i];
if (!this.OExistByPrimaryKey(param, tableName, primaryKey, null))
{
num += this.OInsert(param, tableName, transaction, commandTimeout);
}
else
{
num += this.OUpdateByPrimaryKey(param, tableName, primaryKey, transaction, commandTimeout);
}
}
result = num;
}
}
return result;
}
public int OInsertOrUpdate(object param, string primaryKey = null, IDbTransaction transaction = null, int? commandTimeout = null)
{
object arrayFirst = this.GetArrayFirst(param);
bool flag = arrayFirst != null;
int result;
if (this.GetDataBaseType() == DataBaseType.SqlConnection)
{
ObjectParser objectParser = ObjectParser.Bulid(arrayFirst ?? param, primaryKey, true);
result = this.Execute(string.Concat(new string[]
{
"IF Not EXISTS (SELECT * FROM dbo.AppUserConfig WHERE UserID=@UserID) insert into ",
objectParser.TableName,
"(",
objectParser.GetSQL_InsertField(),
") values (",
objectParser.GetSQL_InsertValue(),
")ELSE update ",
objectParser.TableName,
" set ",
objectParser.GetSQL_UpdateFieldValue("", null),
" where ",
objectParser.PrimaryPropertyInfo.Name,
"=@",
objectParser.PrimaryPropertyInfo.Name
}), param, transaction, commandTimeout, null);
}
else
{
if (!flag)
{
if (!this.OExistByPrimaryKey(param, primaryKey, null))
{
result = this.OInsert(param, transaction, commandTimeout);
}
else
{
result = this.OUpdateByPrimaryKey(param, primaryKey, transaction, commandTimeout);
}
}
else
{
object[] array = param as object[];
int num = 0;
object[] array2 = array;
for (int i = 0; i < array2.Length; i++)
{
object obj = array2[i];
if (!this.OExistByPrimaryKey(param, primaryKey, null))
{
num += this.OInsert(param, transaction, commandTimeout);
}
else
{
num += this.OUpdateByPrimaryKey(param, primaryKey, transaction, commandTimeout);
}
}
result = num;
}
}
return result;
}
public bool OExistByPrimaryKey(object param, string tableName = null, string primaryKey = null, int? commandTimeout = null)
{
ObjectParser oParser = ObjectParser.Bulid(param, tableName, primaryKey, true);
return this.OExistByPrimaryKeyHandle(param, oParser);
}
public bool OExistByPrimaryKey(object param, string primaryKey = null, int? commandTimeout = null)
{
ObjectParser oParser = ObjectParser.Bulid(this.GetArrayFirst(param) ?? param, primaryKey, true);
return this.OExistByPrimaryKeyHandle(param, oParser);
}
private bool OExistByPrimaryKeyHandle(object param, ObjectParser oParser)
{
object value = this.ExecuteScalar(string.Concat(new string[]
{
"select count(*) from ",
oParser.TableName,
" where ",
oParser.PrimaryPropertyInfo.Name,
"=@",
oParser.PrimaryPropertyInfo.Name
}), param, null, null, null);
return Convert.ToInt32(value) > 0;
}
public int ODeleteByPrimaryKey(object param, string tableName = null, string primaryKey = null, IDbTransaction transaction = null, int? commandTimeout = null)
{
ObjectParser oParser = ObjectParser.Bulid(this.GetArrayFirst(param) ?? param, tableName, primaryKey, true);
return this.ODeleteByPrimaryKeyHandle(param, transaction, commandTimeout, oParser);
}
public int ODeleteByPrimaryKey(object param, string primaryKey = null, IDbTransaction transaction = null, int? commandTimeout = null)
{
ObjectParser oParser = ObjectParser.Bulid(this.GetArrayFirst(param) ?? param, primaryKey, true);
return this.ODeleteByPrimaryKeyHandle(param, transaction, commandTimeout, oParser);
}
private int ODeleteByPrimaryKeyHandle(object param, IDbTransaction transaction, int? commandTimeout, ObjectParser oParser)
{
return this.Execute(string.Concat(new string[]
{
"delete from ",
oParser.TableName,
" where ",
oParser.PrimaryPropertyInfo.Name,
"=@",
oParser.PrimaryPropertyInfo.Name
}), param, transaction, commandTimeout, null);
}
public int ODelete(object param, string where, string tableName = null, IDbTransaction transaction = null, int? commandTimeout = null)
{
ObjectParser oParser = ObjectParser.Bulid(this.GetArrayFirst(param) ?? param, tableName, null, false);
return this.ODeleteHandle(param, where, transaction, commandTimeout, oParser);
}
public int ODelete(object param, string where, IDbTransaction transaction = null, int? commandTimeout = null)
{
ObjectParser oParser = ObjectParser.Bulid(this.GetArrayFirst(param) ?? param, null, false);
return this.ODeleteHandle(param, where, transaction, commandTimeout, oParser);
}
private int ODeleteHandle(object param, string where, IDbTransaction transaction, int? commandTimeout, ObjectParser oParser)
{
return this.Execute("delete from " + oParser.TableName + ((!string.IsNullOrEmpty(where)) ? (" where " + where) : ""), param, transaction, commandTimeout, null);
}
public int OCount(object param, string where = null, string tableName = null, IDbTransaction transaction = null)
{
ObjectParser objectParser = ObjectParser.Bulid(param, tableName, null, false);
return this.QuerySingle("select count(*) from " + objectParser.TableName + ((!string.IsNullOrEmpty(where)) ? (" where " + where) : ""), param, transaction, null, null);
}
public int OCount(object param, string where = null, IDbTransaction transaction = null, int? commandTimeout = null)
{
ObjectParser objectParser = ObjectParser.Bulid(param, null, false);
return this.QuerySingle("select count(*) from " + objectParser.TableName + ((!string.IsNullOrEmpty(where)) ? (" where " + where) : ""), param, transaction, null, null);
}
public int Execute(CommandDefinition command)
{
return this.Connection.Execute(command);
}
public int Execute(string sql, object param = null, IDbTransaction transaction = null, int? commandTimeout = null, CommandType? commandType = null)
{
return this.Connection.Execute(sql, param, transaction, commandTimeout, commandType);
}
public IDataReader ExecuteReader(CommandDefinition command)
{
return this.Connection.ExecuteReader(command);
}
public IDataReader ExecuteReader(CommandDefinition command, CommandBehavior commandBehavior)
{
return this.Connection.ExecuteReader(command, commandBehavior);
}
public IDataReader ExecuteReader(string sql, object param = null, IDbTransaction transaction = null, int? commandTimeout = null, CommandType? commandType = null)
{
return this.Connection.ExecuteReader(sql, param, transaction, commandTimeout, commandType);
}
public T ExecuteScalar(CommandDefinition command)
{
return this.Connection.ExecuteScalar(command);
}
public object ExecuteScalar(CommandDefinition command)
{
return this.Connection.ExecuteScalar(command);
}
public T ExecuteScalar(string sql, object param = null, IDbTransaction transaction = null, int? commandTimeout = null, CommandType? commandType = null)
{
return this.Connection.ExecuteScalar(sql, param, transaction, commandTimeout, commandType);
}
public object ExecuteScalar(string sql, object param = null, IDbTransaction transaction = null, int? commandTimeout = null, CommandType? commandType = null)
{
return this.Connection.ExecuteScalar(sql, param, transaction, commandTimeout, commandType);
}
public IEnumerable Query(CommandDefinition command)
{
return this.Connection.Query(command);
}
public IEnumerable Query(string sql, object param = null, IDbTransaction transaction = null, bool buffered = true, int? commandTimeout = null, CommandType? commandType = null)
{
return this.Connection.Query(sql, param, transaction, buffered, commandTimeout, commandType);
}
[return: Dynamic(new bool[]
{
false,
true
})]
public IEnumerable Query(string sql, object param = null, IDbTransaction transaction = null, bool buffered = true, int? commandTimeout = null, CommandType? commandType = null)
{
return this.Connection.Query(sql, param, transaction, buffered, commandTimeout, commandType);
}
public IEnumerable Query(Type type, string sql, object param = null, IDbTransaction transaction = null, bool buffered = true, int? commandTimeout = null, CommandType? commandType = null)
{
return this.Connection.Query(type, sql, param, transaction, buffered, commandTimeout, commandType);
}
public IEnumerable Query(string sql, Func map, object param = null, IDbTransaction transaction = null, bool buffered = true, string splitOn = "Id", int? commandTimeout = null, CommandType? commandType = null)
{
return this.Connection.Query(sql, map, param, transaction, buffered, splitOn, commandTimeout, commandType);
}
public IEnumerable Query(string sql, Func map, object param = null, IDbTransaction transaction = null, bool buffered = true, string splitOn = "Id", int? commandTimeout = null, CommandType? commandType = null)
{
return this.Connection.Query(sql, map, param, transaction, buffered, splitOn, commandTimeout, commandType);
}
public IEnumerable Query(string sql, Func map, object param = null, IDbTransaction transaction = null, bool buffered = true, string splitOn = "Id", int? commandTimeout = null, CommandType? commandType = null)
{
return this.Connection.Query(sql, map, param, transaction, buffered, splitOn, commandTimeout, commandType);
}
public IEnumerable Query(string sql, Func map, object param = null, IDbTransaction transaction = null, bool buffered = true, string splitOn = "Id", int? commandTimeout = null, CommandType? commandType = null)
{
return this.Connection.Query(sql, map, param, transaction, buffered, splitOn, commandTimeout, commandType);
}
public IEnumerable Query(string sql, Func map, object param = null, IDbTransaction transaction = null, bool buffered = true, string splitOn = "Id", int? commandTimeout = null, CommandType? commandType = null)
{
return this.Connection.Query(sql, map, param, transaction, buffered, splitOn, commandTimeout, commandType);
}
public IEnumerable Query(string sql, Func map, object param = null, IDbTransaction transaction = null, bool buffered = true, string splitOn = "Id", int? commandTimeout = null, CommandType? commandType = null)
{
return this.Connection.Query(sql, map, param, transaction, buffered, splitOn, commandTimeout, commandType);
}
public IEnumerable Query(string sql, Type[] types, Func map, object param = null, IDbTransaction transaction = null, bool buffered = true, string splitOn = "Id", int? commandTimeout = null, CommandType? commandType = null)
{
return this.Connection.Query(sql, types, map, param, transaction, buffered, splitOn, commandTimeout, commandType);
}
public T QueryFirst(CommandDefinition command)
{
return this.Connection.QueryFirst(command);
}
[return: Dynamic]
public dynamic QueryFirst(string sql, object param = null, IDbTransaction transaction = null, int? commandTimeout = null, CommandType? commandType = null)
{
return this.Connection.QueryFirst(sql, param, transaction, commandTimeout, commandType);
}
public T QueryFirst(string sql, object param = null, IDbTransaction transaction = null, int? commandTimeout = null, CommandType? commandType = null)
{
return this.Connection.QueryFirst(sql, param, transaction, commandTimeout, commandType);
}
public object QueryFirst(Type type, string sql, object param = null, IDbTransaction transaction = null, int? commandTimeout = null, CommandType? commandType = null)
{
return this.Connection.QueryFirst(type, sql, param, transaction, commandTimeout, commandType);
}
public T QueryFirstOrDefault(CommandDefinition command)
{
return this.Connection.QueryFirstOrDefault(command);
}
[return: Dynamic]
public dynamic QueryFirstOrDefault(string sql, object param = null, IDbTransaction transaction = null, int? commandTimeout = null, CommandType? commandType = null)
{
return this.Connection.QueryFirstOrDefault(sql, param, transaction, commandTimeout, commandType);
}
public T QueryFirstOrDefault(string sql, object param = null, IDbTransaction transaction = null, int? commandTimeout = null, CommandType? commandType = null)
{
return this.Connection.QueryFirstOrDefault(sql, param, transaction, commandTimeout, commandType);
}
public object QueryFirstOrDefault(Type type, string sql, object param = null, IDbTransaction transaction = null, int? commandTimeout = null, CommandType? commandType = null)
{
return this.Connection.QueryFirstOrDefault(type, sql, param, transaction, commandTimeout, commandType);
}
public SqlMapper.GridReader QueryMultiple(CommandDefinition command)
{
return this.Connection.QueryMultiple(command);
}
public SqlMapper.GridReader QueryMultiple(string sql, object param = null, IDbTransaction transaction = null, int? commandTimeout = null, CommandType? commandType = null)
{
return this.Connection.QueryMultiple(sql, param, transaction, commandTimeout, commandType);
}
public T QuerySingle(CommandDefinition command)
{
return this.Connection.QuerySingle(command);
}
[return: Dynamic]
public dynamic QuerySingle(string sql, object param = null, IDbTransaction transaction = null, int? commandTimeout = null, CommandType? commandType = null)
{
return this.Connection.QuerySingle(sql, param, transaction, commandTimeout, commandType);
}
public T QuerySingle(string sql, object param = null, IDbTransaction transaction = null, int? commandTimeout = null, CommandType? commandType = null)
{
return this.Connection.QuerySingle(sql, param, transaction, commandTimeout, commandType);
}
public object QuerySingle(Type type, string sql, object param = null, IDbTransaction transaction = null, int? commandTimeout = null, CommandType? commandType = null)
{
return this.Connection.QuerySingle(type, sql, param, transaction, commandTimeout, commandType);
}
public T QuerySingleOrDefault(CommandDefinition command)
{
return this.Connection.QuerySingleOrDefault(command);
}
[return: Dynamic]
public dynamic QuerySingleOrDefault(string sql, object param = null, IDbTransaction transaction = null, int? commandTimeout = null, CommandType? commandType = null)
{
return this.Connection.QuerySingleOrDefault(sql, param, transaction, commandTimeout, commandType);
}
public T QuerySingleOrDefault(string sql, object param = null, IDbTransaction transaction = null, int? commandTimeout = null, CommandType? commandType = null)
{
return this.Connection.QuerySingleOrDefault(sql, param, transaction, commandTimeout, commandType);
}
public object QuerySingleOrDefault(Type type, string sql, object param = null, IDbTransaction transaction = null, int? commandTimeout = null, CommandType? commandType = null)
{
return this.Connection.QuerySingleOrDefault(type, sql, param, transaction, commandTimeout, commandType);
}
}