abp EventBus实现订阅事件出现 Cannot access a disposed context instance
t-jian 时间:2021-10-08
试发现执行到这里就会抛出异常,db上下文已被释放
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. Object name: 'xxxDbContext
解决方式
方法上添加 [UnitOfWork],方法添加 virtual 修饰符
特别声明:本站部分内容收集于互联网是出于更直观传递信息的目的。该内容版权归原作者所有,并不代表本站赞同其观点和对其真实性负责。如该内容涉及任何第三方合法权利,请及时与824310991@qq.com联系,我们会及时反馈并处理完毕。