title: Use default controller container if Unity registered types has not got this current controller defined
body: <p>First time with Unity,</p>
  
  <p>I have set up a class like this and registered in global.asax:</p>
  
  <pre><code>public class UnityControllerFactory : DefaultControllerFactory
  {
      private IUnityContainer container;
  
      public UnityControllerFactory()
      {
          container = new UnityContainer();
          RegisterTypes();
      }
  
      protected override IController GetControllerInstance(
        System.Web.Routing.RequestContext requestContext, 
        Type controllerType)
      {
          return controllerType == null ?
              null :
              (IController)container.Resolve(controllerType);
      }
  
      private void RegisterTypes()
      {
          container.RegisterType&lt;IUserRepository, EFUserRepository&gt;();
      }
  }
  </code></pre>
  
  <p>Problem is, when the AccountController (default MVC project comes with) is called, it throws an error:</p>
  
  <blockquote>
    <p>An exception of type 'Microsoft.Practices.Unity.ResolutionFailedException' occurred in Microsoft.Practices.Unity.dll but was not handled in user code</p>
  </blockquote>
  
  <p>I can see there is a method to check if a type has been registered, but when I have made that check, how do I force the framework to use the default controller thingy?</p>
  
  <pre><code>if (container.IsRegistered(controllerType))
  </code></pre>
  
  <p>Here is my routing, as you can see... I want the login page to be the first page people see..</p>
  
  <pre><code>public class RouteConfig
  {
      public static void RegisterRoutes(RouteCollection routes)
      {
          routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
  
          routes.MapRoute(
              name: "Default",
              url: "{controller}/{action}/",
              defaults: new {
                   controller = "Account",
                   action = "Login",
                   returnUrl = UrlParameter.Optional }
          );
      }
  }
  </code></pre>