title: How to resolve a named instance from a static class?
body: <p>Does anyone have any idea about what i doing wrong?</p>
  
  <p>I have a such static class:</p>
  
  <pre><code>public static class ApplicationContainer
  {
      private static ContainerBuilder builder = null;
      private static IContainer container = null;
  
      public static void Create()
      {
          builder = new ContainerBuilder();
  
          builder.RegisterInstance(new Repository&lt;Log&gt;(RepositoryType.Main))
              .As&lt;IRepository&lt;Log&gt;&gt;().SingleInstance()
              .Named("Log", typeof(Repository&lt;Log&gt;));
  
          container = builder.Build();
      }     
  
      public static IContainer Container()
      {
          if (container != null) return container;
          throw new Exception("Container is not ready.");
      }
  }
  </code></pre>
  
  <p>In Global.asax.cs of my MVC application i have:</p>
  
  <pre><code>    protected void Application_Start()
      {
          AreaRegistration.RegisterAllAreas();
  
          ApplicationContainer.Create(); 
  
          RegisterRoutes(RouteTable.Routes);
      }
  </code></pre>
  
  <p>And now about problem: how can i to resolve named instance from a container?</p>
  
  <pre><code>public class DefaultLogger : ILogger
  {
      ApplicationContainer.Container().Resolve("Log", typeof(Repository&lt;Log&gt;);// &lt;--- does not work
  }
  </code></pre>
  
  <p>But when ApplicationContainer class is not static, resolving from container works very good.
  I use autofac 2.2.4.</p>