controller-factory

Resolving named registration using Unity 2 in DefaultControllerFactory

橙三吉。 提交于 2020-01-04 06:06:09
问题 I have an issue with resolving named registrations of registered types in Unity 2 using ASP.NET MVC 3 with DI set in DefaultControllerFactory. In one assembly I have defined Unity container with registration types and named registrations public class VisUnityContainer : UnityContainer { public IUnityContainer RegisterVisComponents() { // register types this .RegisterType<ICompanyService, CompanyService>() .RegisterType<ICompanyService, TestCompanyService>( "2" ); } } and in my MVC project I

Resolving named registration using Unity 2 in DefaultControllerFactory

纵饮孤独 提交于 2020-01-04 06:05:18
问题 I have an issue with resolving named registrations of registered types in Unity 2 using ASP.NET MVC 3 with DI set in DefaultControllerFactory. In one assembly I have defined Unity container with registration types and named registrations public class VisUnityContainer : UnityContainer { public IUnityContainer RegisterVisComponents() { // register types this .RegisterType<ICompanyService, CompanyService>() .RegisterType<ICompanyService, TestCompanyService>( "2" ); } } and in my MVC project I

Best place to set CurrentCulture for multilingual ASP.NET MVC web applications

浪尽此生 提交于 2019-12-27 17:19:46
问题 For multilingual ASP.NET MVC 3 web application, I am determining the Thread.CurrentThread.CurrentCulture and Thread.CurrentThread.CurrentUICulture on the controller factory as follows: public class MyControllerFactory : DefaultControllerFactory { protected override IController GetControllerInstance(System.Web.Routing.RequestContext requestContext, Type controllerType) { //Get the {language} parameter in the RouteData string UILanguage; if (requestContext.RouteData.Values["language"] == null)

Best place to set CurrentCulture for multilingual ASP.NET MVC web applications

一笑奈何 提交于 2019-12-27 17:19:36
问题 For multilingual ASP.NET MVC 3 web application, I am determining the Thread.CurrentThread.CurrentCulture and Thread.CurrentThread.CurrentUICulture on the controller factory as follows: public class MyControllerFactory : DefaultControllerFactory { protected override IController GetControllerInstance(System.Web.Routing.RequestContext requestContext, Type controllerType) { //Get the {language} parameter in the RouteData string UILanguage; if (requestContext.RouteData.Values["language"] == null)

Custom ControllerFactory with autofac

混江龙づ霸主 提交于 2019-12-21 23:26:24
问题 First of all i am a newbie in asp mvc so please be patient. Currently I want to create project where autofac will be IoC container i will reqister custom controller factory. In custom controller factory I want to set implementation Data Repository via constructor of controller. I thought it should be done in that way: ContainerBuilder builder = new ContainerBuilder(); builder.RegisterControllers(asm).InstancePerHttpRequest(); builder.Register(s => new ControllerFactory()).As

How do I get Web API / Castle Windsor to recognize a Controller?

旧时模样 提交于 2019-12-21 23:00:21
问题 I found out why the placeholder "Home Controller" was getting called here I commented out the reference to HomeController in RouteConfig.cs and added a Controller that I want it to call instead: public class RouteConfig { public static void RegisterRoutes(RouteCollection routes) { routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); //If get 404 error re: favicon, see http://docs.castleproject.org/(X(1)S(vv4c5o450lhlzb45p5wzrq45))/Windsor.Windsor-tutorial-part-two-plugging-Windsor-in.ashx or

ControllerFactory for specific portable area

心不动则不痛 提交于 2019-12-13 11:51:10
问题 My main ASP.NET MVC composite application uses a global Unity container to register types. The app sets the controller factory up to use this global container. I would like to refactor this such that each one of my portable areas leverages it's own child Unity container, so that different areas can implement interfaces in varying ways. It seems like I would need to have a different ControllerFactory per area. How would I accomplish that, given that the following sets the factory for all?

If you are starting a new MVC3 project which adaption will you choose DependencyResolver or ControllerFactory with Castle Windsor?

纵饮孤独 提交于 2019-12-11 04:24:33
问题 I am new to the ioc containers and confused how to integrate a container to mvc3... There is a sample that uses ControllerFactory... https://github.com/kkozmic/ToBeSeen/blob/master/src/ToBeSeen/Plumbing/WindsorControllerFactory.cs There is a blog post that says "The MVC 3.0 IDependencyResolver interface is broken. Don’t use it with Windsor." http://mikehadlow.blogspot.com/2011/02/mvc-30-idependencyresolver-interface-is.html and from this link I think I also need to implement

Custom ControllerFactory with autofac

瘦欲@ 提交于 2019-12-04 19:41:02
First of all i am a newbie in asp mvc so please be patient. Currently I want to create project where autofac will be IoC container i will reqister custom controller factory. In custom controller factory I want to set implementation Data Repository via constructor of controller. I thought it should be done in that way: ContainerBuilder builder = new ContainerBuilder(); builder.RegisterControllers(asm).InstancePerHttpRequest(); builder.Register(s => new ControllerFactory()).As<IControllerFactory>(); IContainer container = builder.Build(); DependencyResolver.SetResolver(new

JavaFX custom controller factory

帅比萌擦擦* 提交于 2019-12-04 18:53:00
问题 I have been experimenting with the FXMLLoader and using the setControllerFactory method using a custom Callback<P,R> implementation. The ORACLE documentation says the following: An implementation might return a null value to indicate that it does not or cannot create a controller of the given type; in this case, the default controller construction mechanism will be employed by the loader. The result I want to achieve is that I can use a dependency injection framework to create any controllers