1.4.3
在Task中使用Db.GetNewDbContext(),实际没有new新的DbContext,怀疑是生命周期出问题了。
我手撸了一个DbContext发现可以,应该是Fur出问题了
Cannot access a disposed context instance. A common cause of this error is disposing a context instance that was resolved from dependency injection and then later trying to use the same context instance elsewhere in your application. This may occur if you are calling 'Dispose' on the context instance, or wrapping it in a using statement. If you are using dependency injection, you should let the dependency injection container take care of disposing context instances.
期待的结果是?
确实是 Furion 框架问题,已经修复,晚点更新call你,测试代码。
public void 测试数据库上下文()
{
for (int i = 0; i < 3; i++)
{
using (var db = Db.GetNewDbContext())
{
var p = db.Set<Person>().FirstOrDefault(u => u.Id == 1);
Console.WriteLine(p.Name);
}
using (var db1 = Db.GetNewDbContext())
{
var p = db1.Set<Person>().FirstOrDefault(u => u.Id == 1);
Console.WriteLine(p.Name);
}
}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。
😋 close #I34XD0:👛 [优化] 移除 `Sql` 查询结果映射检查 `[NotMapper]` 特性机制 #I38NNP.
-----来自 commit de9b092
登录 后才可以发表评论