Microsoft.Extensions.DependencyInjection错误

时间:2019-03-13 20:15:52

标签: asp.net-core-2.2

有人可以告诉我这是什么错误吗?

  

Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteFactory.CreateArgumentCallSites(类型serviceType,类型ImplementationType,CallSiteChain callSiteChain,ParameterInfo []参数,布尔型throwIfCallSiteNotFound)

我有一个Service和IService,例如ITest.cs和TestRepository,我在启动类中注册了它

services.AddScoped<ITest, TestRepository>();

我在数据库中使用Mongodb。

1 个答案:

答案 0 :(得分:0)

我找到了解决方案,但忘记了注册通用类

services.AddTransient(typeof(IRepository<>), typeof(MongoDBRepository<>));
相关问题