Autofac and Web API scopes

泪湿孤枕 提交于 2019-12-10 16:27:56

问题


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:


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.



来源:https://stackoverflow.com/questions/12069981/autofac-and-web-api-scopes

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!