Return to Snippet

Revision: 47678
at June 13, 2011 19:55 by nivlam


Initial Code
public class WindsorControllerFactory : DefaultControllerFactory
{
    private readonly IWindsorContainer container;

    public WindsorControllerFactory(IWindsorContainer container)
    {
        this.container = container;
    }

    public override void ReleaseController(IController controller)
    {
        container.Kernel.ReleaseComponent(controller);
    }

    protected override IController GetControllerInstance(RequestContext context, Type controllerType)
    {
        if (controllerType == null)
            base.GetControllerInstance(context, controllerType);

        return (IController)container.Kernel.Resolve(controllerType);
    }
}

Initial URL

                                

Initial Description

                                

Initial Title
MVC - Windsor controller factory

Initial Tags

                                

Initial Language
C#