在一个asp.net core webapi项目的集成测试中遭遇下面的异常,请问如何解决?
Cannot access a disposed object. A common cause of this error is disposing a context 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, or wrapping the context in a using statement. If you are using dependency injection, you should let the dependency injection container take care of disposing context instances. [xUnit.net 00:00:03.2384249] Object name: 'EfUnitOfWork'. [xUnit.net 00:00:03.2425838] Stack Trace:
依赖注入用的是 services.AddScoped
阿波罗的战车