定时任务本来我用的都是CreateWork 现在都换成了CreateUnitOfWork 。这个时候就会报错如下
System. objectDisposed Exception:"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 ' Disp he contex止t g statement. If you are using dependency injection, you should let the dependency injection container take care of disposing context instance
举例:
A服务.1方法 三秒执行一次,更新数据库
A服务.2方法 5秒执行一次,更新数据库
都使用定时任务,通过Scope.CreateUnitofWork 创建A服务,在执行savechanges的时候会报错,是因为创建出来的是同一个还是说EF上下文相同
期待的结果是?
定时任务使用CreateUnifOfWork可以让saveChanges正常执行,而不是使用一个相同的上下文。
这样的 Issue 没有任何价值。代码没有给出,详细的错误堆栈没给出。
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。
经过测试,并无发现 Furion 框架问题,建议升级到最新版再测试。
登录 后才可以发表评论