什么是DefaultControllerFactory在网页API相当于? [英] What is the equivalent of DefaultControllerFactory in Web API?

查看:169
本文介绍了什么是DefaultControllerFactory在网页API相当于?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们试图取代$ P $与新的ASP.NET Web API pvious DefaultControllerFactory更好地处理REST / XML调用。一直在网上搜索指向implementating System.Web.Http.Dependencies.IDependencyResolver ,然后处理 GetService的()和由接口需要一些其他的方法。

We are trying to replace previous DefaultControllerFactory with new ASP.NET Web API to better handle REST/XML calls. Searching the web always pointed to implementating System.Web.Http.Dependencies.IDependencyResolver and then handling the GetService() and few other methods required by the interface.

但它似乎缓存ApiController实例和任何新的控制器,它似乎并没有被解决。它难以启动时,由于性能问题提供一切可能的ApiController实例。

However it seems to be caching the ApiController instance and any new controller, it does not seem to be resolving. Its difficult to provide all possible ApiController instances during startup due to performance issues.

DefaultControllerFactory 允许提供控制器实例和缓存打的条目,但一个instane不能延迟加载时抛出错误。

DefaultControllerFactory allows providing controller instances and caches the "hit" entries, but throws errors when the an instane could not be delay loaded.

是否有其他重载/控制器工厂方法,需要得到执行?

搜索没有取得任何安打,到目前为止,但任何指针将是巨大的。感谢您的时间。

Search did not yield any hits so far, but any pointers will be great. Thank you for your time.

推荐答案

IHttpControllerActivator DefaultHttpControllerActivator

您可以用替换它:

GlobalConfiguration.Configuration.Services.Replace(typeof(IHttpControllerActivator), 
        new MyOwnActivatior());

我的意思是 IHttpControllerSelector

IHttpControllerSelector DefaultHttpControllerSelector 实施

您可以用替换它:

GlobalConfiguration.Configuration.Services.Replace(typeof(IHttpControllerSelector), 
        new MyOwnActivatior());

这篇关于什么是DefaultControllerFactory在网页API相当于?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆