Skip to content

Can't register custom ControllerFactory #492

@7702244

Description

@7702244

When I'm using MvcSiteMapProvider I can't register custom ControllerFactory in Application_Start, because MvcSiteMapProvider redefines it later, so my CustomControllerFactory have no effect.

protected void Application_Start()
        {
            //Prints: System.Web.Mvc.DefaultControllerFactory
            logger.Info(ControllerBuilder.Current.GetControllerFactory().ToString());

            ControllerBuilder.Current.SetControllerFactory(new CustomControllerFactory());

            //Prints: WebApplication.Utils.CustomControllerFactory
            logger.Info(ControllerBuilder.Current.GetControllerFactory().ToString());
        }

        protected void Application_BeginRequest(object sender, EventArgs e)
        {
            //Prints: MvcSiteMapProvider.DI.ControllerFactoryDecorator
            logger.Info(ControllerBuilder.Current.GetControllerFactory().ToString());
        }

MvcSiteMapProvider.DI.ControllerFactoryDecorator doesn't use my CustomControllerFactory as a base.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions