title: Autofac cannot resolve parameter 'System.String applicationClientId' of constructor
body: <p>I have the following class/interface structure:</p>
  
  <pre><code>class ProviderSetting
  {
      public delegate ProviderSetting Factory(string applicationClientId,
          string appKey);
  
      public ProviderSetting (string applicationClientId, string appKey)
      { ... }
  }
  </code></pre>
  
  <p>and</p>
  
  <pre><code>class Provider : IProvider
  {
      public Provider(ProviderSetting setting)
      { ... }
  }
  </code></pre>
  
  <p>and</p>
  
  <pre><code>class Ingestor: IIngestor
  {
      public Ingestor (IProvider provider)
      { ... }
  }
  </code></pre>
  
  <p>I use autofac to perform dependency injection in the following manner:</p>
  
  <pre><code>var builder = new ContainerBuilder();
  builder.RegisterType&lt;ProviderSetting&gt;().AsSelf();
  builder.RegisterGeneratedFactory(typeof(ProviderSetting.Factory));
  builder.RegisterType&lt;Provider&gt;().As&lt;IProvider&gt;();
  builder.RegisterType&lt;Ingestor&gt;().As&lt;IIngestor&gt;();
  </code></pre>
  
  <p>and resolve as follows:</p>
  
  <pre><code>var settings = container.Resolve&lt;ProviderSetting.Factory&gt;().Invoke("&lt;appId&gt;", "&lt;appKey&gt;");
  var provider = container.Resolve&lt;IProvider&gt;(new TypedParameter(typeof(ProviderSetting), settings));
  var ingestor = container.Resolve&lt;IIngestor&gt;(new TypedParameter(typeof(Provider), provider));
  </code></pre>
  
  <p>But I get the exception that:</p>
  
  <blockquote>
    <p>DependencyResolutionException: None of the constructors found with 'Autofac.Core.Activators.Reflection.DefaultConstructorFinder' on type 'ProviderSettings' can be invoked with the available services and parameters:
        Cannot resolve parameter 'System.String applicationClientId' of constructor 'Void .ctor(System.String, System.String)'.</p>
  </blockquote>
  
  <p>What am I missing here?</p>