【发布时间】:2020-01-18 00:48:00
【问题描述】:
我正在使用以下方式在 MySQL 数据库上的 dapper 中进行查询。
using (var db = new MySqlConnection(ConfigurationHandler.GetSection<string>(StringConstants.ConnectionString)))
{
resultSet = db.Execute(UpdateQuery, new { _val = terminalId }, commandType: CommandType.Text);
db.Close();//should i call this or not
db.Dispose();//should i call this or not
}
这是显式调用 db.close 和 db.dispose 的好方法吗?我的应用程序每秒可以处理 100 个请求。
【问题讨论】:
-
您不需要
Close或Dispose。using已经为您调用Dispose。 -
resultSet的类型是什么? -
resultSet 不同点不同
标签: c# mysql .net .net-core dapper