title: how to inject same instance of one component into several others?
body: <p>Using Autofac, I have the following scenario:</p>
  
  <pre><code>public class MainClass
  {
       public delegate MainClass Factory();
       public MainClass(Report report, SecondaryClass secClass)
       {
           Report=report;
           SecondaryClass = secClass;
       }
       public Report Report {get; private set;}
       public SecondaryClass SecondaryClass {get; private set;}
  }
  
  public class SecondaryClass
  {   
       public SecondaryClass(Report report)
       {
           Report=report;
       }
       public Report Report {get; private set;}
  }
  </code></pre>
  
  <p>What I would like to achieve is that every time I invoke the Factory() delegate on MainClass, both MainClass and SecondaryClass are injected with the same instance of Report.</p>
  
  <p>Basically</p>
  
  <pre><code>public void MyMethod()
  {
       var myMainClass = _MainClassFactory.Invoke();
       //How do I do achieve this????
       Debug.Assert (object.ReferenceEquals(myMainClass.Report , myMainClass.SecondaryClass.Report));
  }
  </code></pre>
  
  <p>How can I configure MainClass and SecondaryClass?
  My current configuration is the following, but it does not seem to achieve what I want.
  As a matter of fact, every time I call the Factory method, I get the same instance of Report.</p>
  
  <pre><code>        builder.RegisterType&lt;MainClass&gt;().AsSelf();
          builder.RegisterType&lt;SecondaryClass&gt;().AsSelf();
          builder.RegisterType&lt;Report&gt;().AsSelf().InstancePerLifetimeScope();
  </code></pre>