[英]How to inject/Register MediatR ServiceFactory in .Net 6?
我有一个最初用.Netcore 3.1 编写的项目。 我正在将这个项目迁移到.Net6.0。
我曾经使用 Lifetime: Transient 注入/注册 MediatR ServiceFactory。
services.AddTransient<ServiceFactory, ServiceFactory>();
但是当我迁移到 .Net6.0 时,我收到一条错误消息:
InvalidOperationException: Error while validating the service descriptor 'ServiceType: MediatR.ServiceFactory Lifetime: Transient ImplementationType: MediatR.ServiceFactory': Unable to resolve service for type 'System.Object' while attempting to activate 'MediatR.ServiceFactory'.
我想知道如何在 .Net6.0 中注入/注册 MediatR ServiceFactory?
我们不需要将 MediatR 服务工厂注册为单独的东西。 AddMediatR 扩展应该处理这个问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.