dapper支持DataSet
2024-09-01 00:59:14
在源代码中添加
/// <summary>
/// describe:支持 DataSet
/// </summary>
/// <param name="cnn"></param>
/// <param name="adapter"></param>
/// <param name="sql"></param>
/// <param name="param"></param>
/// <param name="buffered"></param>
/// <param name="commandTimeout"></param>
/// <param name="commandType"></param>
/// <returns></returns>
public static DataSet ExecuteDataSet(this IDbConnection cnn, IDbDataAdapter adapter, string sql, object param = null, bool buffered = true, int? commandTimeout = null, CommandType? commandType = null)
{
var ds = new DataSet();
var command = new CommandDefinition(sql, (object)param, null, commandTimeout, commandType, buffered ? CommandFlags.Buffered : CommandFlags.None);
var identity = new Identity(command.CommandText, command.CommandType, cnn, null, param == null ? null : param.GetType(), null);
var info = GetCacheInfo(identity, param, command.AddToCache);
bool wasClosed = cnn.State == ConnectionState.Closed;
if (wasClosed) cnn.Open();
adapter.SelectCommand = command.SetupCommand(cnn, info.ParamReader);
adapter.Fill(ds);
if (wasClosed) cnn.Close();
return ds;
}
最新文章
- 8-07CONTIUE 、 BREAK、RETURN
- 在Excel中制作金字塔条形图
- T-Shirt 估算法
- 初学java之(盒子分布)
- query specified join fetching, but the owner of the fetched association was not present in the select list
- 桂电在线-php-提取菜单到配置文件
- apache2.4配置虚拟目录
- SQL Server -SET ANSI_NULLS
- java中类之间的关系之封装、继承与多态的几个例子
- LVM逻辑卷疑问?
- js之跑马灯广告
- CodeForces - 348D Turtles(LGV)
- 【PyQt5-Qt Designer】QLineEdit 文本输入
- (转)Unity内建图标列表
- c# 正则表达式笔记
- mysql触发器应用和创建表错误代码: 1118 Row size too large. 解决
- C++ 全排列函数 std::next_permutation与std::prev_permutation
- 样式 bootstrap purecss Amaze UI 推荐
- 检查 NaN 数据值 (C/C++/Python 实现)
- powershell 获取 CPU 物理 / 逻辑核心数
热门文章
- Windows软件在Linux上的等价/替代/模仿软件列表 (抄一个)
- SQLServer 远程服务器不存在,未被指定为有效的发布服务器,或您无权查看可用的发布服务器
- ASP.NET MVC 下UpdateModel可空未填写的参数为Null,为何不是空字符串
- PRML Chapter2
- Azure 云助手主要功能
- Qt项目里的源代码默认都是Unicode,原因大概是因为qmake.conf里的定义
- Google Breakpad 在 windows下捕获程序崩溃报告
- 全量导入数据 导致solr内存溢出 崩溃问题解决
- SYN4201型 同步分频钟
- 高性能高并发网站架构,教你搭建Redis5缓存集群