How do I dispose of resources after an ASP.NET Web API request completes?

*爱你&永不变心* 提交于 2019-11-30 16:11:30
Kiran Challa

You can use the extension called RegisterForDispose on the HttpRequestMessage to register any resources that you would like to dispose off when a request is done.

BTW, you might want to look at the following link to regarding IQueryable support in next release of Web API. http://aspnetwebstack.codeplex.com/discussions/359229

[Edited] Doing things in Dispose() method of the Controller would also be a solution. In Web API ApiController based controllers are always per-instance (one controller instance per one request)

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