#region query for dictionary
public abstract IDictionary<K, T> QueryForDictionary<K, T>(string key, string sqlStr)
where T : class, new();
public abstract IDictionary<K, T> QueryForDictionary<K, T>(string key, string sqlStr, Type objType)
where T : class, new();
public abstract IDictionary<K, T> QueryForDictionary<K, T>(string key, string sqlStr, CommandType cmdType, Type objType)
where T : class, new();
public abstract IDictionary<K, T> QueryForDictionary<K, T>(string key, string sqlStr, CommandType cmdType, List<DbParameter> listParams, Type objType)
where T : class, new();
#endregion
#region dataset datatable
public abstract DataTable FillDataTable(string sqlStr, CommandType cmdType, List<DbParameter> listParams);
public abstract DataSet FillDataSet(string sqlStr, CommandType cmdType, List<DbParameter> listParams);
#endregion
#region ExecuteScalar
public abstract object ExecuteScalar(string sqlStr, CommandType cmdType, List<DbParameter> listParams);
#endregion
#region insert
public abstract int Insert(string sqlStr);
public abstract int Insert(string sqlStr, CommandType cmdType, List<DbParameter> listParams);
public abstract bool BatchInsert(string tableName, int batchSize, int copyTimeout, DataTable dt);
#endregion
#region delete
public abstract int Delete(string sqlStr);
public abstract int Delete(string sqlStr, CommandType cmdType, List<DbParameter> listParams);
#endregion
#region update
public abstract int Update(string sqlStr);
public abstract int Update(string sqlStr, CommandType cmdType, List<DbParameter> listParams);
#endregion
}
}
上面代码中的方法您是不是很熟悉呢? 呵呵,使用IBatis.net 的童鞋应该会和楼猪产生更多的共鸣。
2、SqlMapper类
代码
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.Common;
namespace AdoNetDataAccess.Mapper
{
using AdoNetDataAccess.Core.Contract;
using AdoNetDataAccess.Core.Obj2Model;
public class SqlMapper : BaseMapper
{
private SqlMapper()
{
}
public SqlMapper(IDbOperation dbOperation)
{
this.CurrentDbOperation = dbOperation;
}
#region query for list
public override IList<T> QueryForList<T>(string sqlStr)
{
return QueryForList<T>(sqlStr, CommandType.Text, null, typeof(T));
}
public override IList<T> QueryForList<T>(string sqlStr, Type objType)
{
return QueryForList<T>(sqlStr, CommandType.Text, null, objType);
10/13 首页 上一页 8 9 10 11 12 13 下一页 尾页 |