title: Access or get Autofac Container inside a static class
body: <p>I need to get or access to my IoC container in a static class. This is my (simplified) scenario:</p>
  
  <p>I register dependencies for ASP .net Web Api in a Startup class (but also I do this for MVC or WCF. I have a DependecyResolver project, but for simplicity, consider the following code)</p>
  
  <pre><code>// Web Api project - Startup.cs
  public void Configuration(IAppBuilder app)
  {
      HttpConfiguration config = new HttpConfiguration();
  
      var builder = new ContainerBuilder();
  
      // ... Omited for clarity
      builder.RegisterAssemblyTypes(AppDomain.CurrentDomain.GetAssemblies())
          .AsClosedTypesOf(typeof(IHandle&lt;&gt;))
          .AsImplementedInterfaces();
  
      // ...
      IContainer container = builder.Build();
      config.DependencyResolver = new AutofacWebApiDependencyResolver(container);
      // ...
  }
  </code></pre>
  
  <p>Then, in a separate class library I have my static class (again simplified for clarity):</p>
  
  <pre><code>public static class DomainEvents
  {
      private static IContainer Container { get; set; }
  
      static DomainEvents()
      {
          //Container = I need get my Autofac container here
      }
  
      public static void Register&lt;T&gt;(Action&lt;T&gt; callback) where T : IDomainEvent { /* ... */ }
  
      public static void ClearCallbacks() { /* ... */  }
  
      public static void Raise&lt;T&gt;(T args) where T : IDomainEvent
      {
          foreach (var handler in Container.Resolve&lt;IEnumerable&lt;IHandle&lt;T&gt;&gt;&gt;())
          {
              handler.Handle(args);
          }
          // ...
      }
  }
  </code></pre>
  
  <p>Any idea how can I get this?</p>