title: How do I Register Autofac Module with Configuration
body: <p>I have a console application with a reference to a class library which in itself has a reference to a class library (waterfall). The problem is I want to register my <code>IConfiguration</code> by passing it via the Autofac modules and then having them accessible in the lowest library and I am not sure how to achieve this. (The point of my design is to have a standalone NuGet package which can be referenced by console app or website)</p>
  <p>The point is I want to register the main <code>.dll</code> (<code>Notification.Send</code>) in my new website and not have to worry about registering the lower lever <code>.dll</code> (<code>Notification.Queue</code>) yet still have access to the websites <code>appsettings.json</code>. Here is my example</p>
  <p>console application</p>
  <pre class="lang-cs prettyprint-override"><code>    class Program
      {
          static void Main(string[] args)
          {
              IConfiguration Configuration = new ConfigurationBuilder()
                 .AddJsonFile(&quot;appsettings.json&quot;, optional: true, reloadOnChange: true)
                 .AddEnvironmentVariables()
                 .AddCommandLine(args)
                 .Build();
  
              var builder = new ContainerBuilder();
              //How to pass &quot;Configuration&quot; to SendNotificationModule?
              builder.RegisterModule(new SendNotificationModule());
          }
      }
  </code></pre>
  <p>Notifications.Send (Library)</p>
  <pre class="lang-cs prettyprint-override"><code>    public class SendNotificationModule : Module
      {
          protected override void Load(ContainerBuilder builder)
          {
              base.Load(builder);
  
              //How to pass &quot;Configuration&quot; to QueueModule?
              builder.RegisterModule(new QueueModule());
          }
      }
  </code></pre>
  <p>Notifications.Queue (Library)</p>
  <pre class="lang-cs prettyprint-override"><code>    public class QueueModule : Module
      {
          protected override void Load(ContainerBuilder builder)
          {
              base.Load(builder);
  
              //Here I want to register a custom interface which I can use to retrieve config from
              //and then use for DI in my Notifications.Queue dll
  
          }
      }
  </code></pre>
  <p>I'm not too familiar with Autofac and perhaps barking up the wrong tree but I have searched everywhere but cant figure this out.</p>