【发布时间】:2019-08-25 20:22:51
【问题描述】:
我有以下指南:https://autofac.readthedocs.io/en/latest/integration/aspnetcore.html
在最后一步,它显示:
// Create the IServiceProvider based on the container.
return new AutofacServiceProvider(this.ApplicationContainer);
但是,在 Asp Net core 2.2 的最新版本中,函数 ConfigureServices(IServiceCollection services) 是 return void
public void ConfigureServices(IServiceCollection services)
如何根据最新更改重构我的代码?
【问题讨论】:
-
只需将
void替换为IServiceProvider。 -
确实,它有效@John
标签: c# asp.net-core dependency-injection .net-core autofac