title: StructureMap: The name 'ObjectFactory' does not exist in the current context
body: <p>I am using StructureMap to resolve dependency, which works fine with older version.But after updating StructureMap version 4.2.0.40, i am facing this error.</p>
  
  <p><strong>ObjectFactory is now obsoleted in new version.</strong>
  So how to modify below logic to fit this with updated version.</p>
  
  <pre><code>protected override IController GetControllerInstance(RequestContext requestContext, Type controllerType)
          {
              try
              {
                  if ((requestContext == null) || (controllerType == null))
                      return null;
  
                  return (Controller)ObjectFactory.GetInstance(controllerType);
              }
              catch (StructureMapException)
              {
                  System.Diagnostics.Debug.WriteLine(ObjectFactory.WhatDoIHave());
                  throw new Exception(ObjectFactory.WhatDoIHave());
              }
          }
  </code></pre>
  
  <p>Bootstrapper.cs</p>
  
  <pre><code>public static class Bootstrapper
      {
          public static void Run()
          {
              ControllerBuilder.Current
                  .SetControllerFactory(new StructureMapControllerFactory());
  
              ObjectFactory.Initialize(x =&gt;
              {
                  x.AddConfigurationFromXmlFile(@"D:\Samples\Web_API\OneCode\StructureMap.Web\StructureMap.Web\StructureMap.xml");
              });
          }
      }
  }
  </code></pre>