title: Autofac RegisterType with Parameters
body: <p>Please could someone advise on how I go about registering a class with a parameter passed at runtime</p>
  
  <pre><code>public interface ITabContentSending
  {
      TabType TheTabType { get; set; }
      int? OrderId { get; set; }
  }
  public class TabContentSending : ITabContentSending
  {
      public TabType TheTabType { get; set; }
      public int? OrderId { get; set; }
  
      public TabContentSending(int orderId)
      {
          TheTabType = TabType.Table;
          OrderId = orderId;
      }
  
  }
  </code></pre>
  
  <p>My current effort (which are clearly wrong)</p>
  
  <pre><code>            builder.RegisterType&lt;TabContentSending&gt;()
              .As&lt;ITabContentSending&gt;()
              .WithParameter(new ResolvedParameter(
                  (p, c) =&gt; p.ParameterType == typeof(int) &amp;&amp; p.Name == "orderId",
                  (p, c) =&gt; "OrderId"));
  </code></pre>
  
  <p>Results in a runtime Error of:</p>
  
  <blockquote>
    <p>Input string was not in a correct format.
    An exception was thrown while invoking the constructor 'Void .ctor(Int32)' on type 'TabContentSending'. ---> Input string was not in a correct format. (See inner exception for details.)</p>
  </blockquote>