For a multilingual ASP.NET MVC 3 web application, I define Thread.CurrentThread.CurrentCulture and Thread.CurrentThread.CurrentUICulture on the factory controller as follows:
public class MyControllerFactory : DefaultControllerFactory { protected override IController GetControllerInstance(System.Web.Routing.RequestContext requestContext, Type controllerType) {
The code above has been around for almost a year! So, I open for suggestions.
And I will register this in the Global.asax file, for example:
ControllerBuilder.Current.SetControllerFactory(new MyControllerFactory());
This works well, but I'm not sure if this is the best practice and the best place for this type of action.
I did not break into the main role of ControllerFactory , and I cannot compare it to ActionFilterAttribute .
What do you think of the best place for this type of action?
asp.net-mvc asp.net-mvc-3 action-filter
tugberk Nov 22 '11 at 12:05 2011-11-22 12:05
source share