更新日志
IDataBase 弃用两个方法
ExecuteDataReader
ExecuteDataReaderSP
弃用原因:方法的智能不够清晰,容易混淆
IDataBase 新增8个方法
1. 返回
数据集合
List<T>对象SQL 语句
/// <summary> /// 执行SQL语句,返回数据集合 /// </summary> /// <typeparam name="T"></typeparam> /// <param name="sql"></param> /// <param name="parameters"></param> /// <param name="action"></param> /// <returns></returns> List<T> ExecuteDataList<T>(string sql, IDbParms parameters, Func<DbDataReader, T> action); /// <summary> /// 执行SQL语句,返回数据集合 /// </summary> /// <typeparam name="T"></typeparam> /// <param name="sql"></param> /// <param name="parameters"></param> /// <returns></returns> List<T> ExecuteDataList<T>(string sql, IDbParms parameters) where T : new();GarsonZhang www.yesdotnet.com存储过程
/// <summary> /// 执行存储过程,返回数据集合 /// </summary> /// <typeparam name="T"></typeparam> /// <param name="sql"></param> /// <param name="parameters"></param> /// <param name="action"></param> /// <returns></returns> List<T> ExecuteDataListSP<T>(string sql, IDbParms parameters, Func<DbDataReader, T> action); /// <summary> /// 执行存储过程,返回数据集合 /// </summary> /// <typeparam name="T"></typeparam> /// <param name="sql"></param> /// <param name="parameters"></param> /// <returns></returns> List<T> ExecuteDataListSP<T>(string sql, IDbParms parameters) where T : new();GarsonZhang www.yesdotnet.com2. 返回
第一条数据
T 对象SQL 语句
/// <summary> /// 执行SQL语句,返回第一行数据 /// </summary> /// <typeparam name="T"></typeparam> /// <param name="sql"></param> /// <param name="parameters"></param> /// <param name="action"></param> /// <returns></returns> T ExecuteDataFirst<T>(string sql, IDbParms parameters, Func<DbDataReader, T> action); /// <summary> /// 执行SQL语句,返回第一行数据 /// </summary> /// <typeparam name="T"></typeparam> /// <param name="sql"></param> /// <param name="parameters"></param> /// <returns></returns> T ExecuteDataFirst<T>(string sql, IDbParms parameters) where T : new();GarsonZhang www.yesdotnet.com存储过程
/// <summary> /// 执行存储过程,返回第一行数据 /// </summary> /// <typeparam name="T"></typeparam> /// <param name="sql"></param> /// <param name="parameters"></param> /// <param name="action"></param> /// <returns></returns> T ExecuteDataFirstSP<T>(string sql, IDbParms parameters, Func<DbDataReader, T> action); /// <summary> /// 执行存储过程,返回第一行数据 /// </summary> /// <typeparam name="T"></typeparam> /// <param name="sql"></param> /// <param name="parameters"></param> /// <returns></returns> T ExecuteDataFirstSP<T>(string sql, IDbParms parameters) where T : new();GarsonZhang www.yesdotnet.com
方法调整
调整 DatabaseFactory.CreateDatabase 方法,调整参数位置
原因:使用过程中发现CreateDataBase方法的两个重载,参数有点凌乱
public static IDatabase CreateDatabase(string connectionString, string providerName, Action<DbDataAdapter> CustomerDbDataAdapter)
public static IDatabase CreateDatabase(DbProviderFactory dbProviderFactory, string connectionString, Action<DbDataAdapter> CustomerDbDataAdapter)
如上,ConnectionString 参数 一个在第一个参数位置,另一个又在第二个参数位置,修改 第二个 方法
修改前
public static IDatabase CreateDatabase(DbProviderFactory dbProviderFactory, string connectionString, Action<DbDataAdapter> CustomerDbDataAdapter)
GarsonZhang www.yesdotnet.com
修改后
public static IDatabase CreateDatabase(string connectionString, DbProviderFactory dbProviderFactory, Action<DbDataAdapter> CustomerDbDataAdapter)
GarsonZhang www.yesdotnet.com
版权声明:本文为YES开发框架网发布内容,转载请附上原文出处连接
GZHelper YES开发框架