Autofac and Web API scopes

2019-06-24 02:02发布

Earlier i saw this:

.InstancePerApiRequest();

Now i only got this:

.InstancePerHttpRequest();

Did autofac removed the API-scope? I have the reference Autofac.Integration.WebApi but this extension is not available. What is the difference between InstancePerHttpRequest and InstancePerApiRequest?

1条回答
三岁会撩人
2楼-- · 2019-06-24 02:44

InstancePerApiRequest is part of the Web API integration, and InstancePerHttpRequest is part of the MVC integration. These both actually apply the same tag to the lifetime scope. That was done because you might have services that are dependencies of both Web API and MVC controllers.

查看更多
登录 后发表回答