title: SatisfyImportsOnce vs ComposeParts
body: <p>Can someone please explain the difference between <code>SatisfyImportsOnce</code> and <code>ComposeParts</code> and why one would work where the other doesn't?</p>
  
  <p>Specifically I have a MVC Web application that I am using MEF in. Below is some code (from that application) that works when I use <code>SatisfyImportsOnce</code> but doesn't when I use <code>ComposeParts</code>. My understanding is that <code>ComposeParts</code> creates composable parts from an array of attributed objects and composes them in the specified composition container and that <code>SatisfyImportsOnce</code>  composes the specified part by using the specified composition service. To my simple monkey brain even though the English is different they are semantically the same. Both use the <code>CompositionContainer</code> to spit exported types at import targets.</p>
  
  <pre><code>public class FormPartCustomatorFactory
  {
  
      [ImportMany(typeof(ICustomRenderer), AllowRecomposition = true)]
      private readonly List&lt;Lazy&lt;ICustomRenderer, ICustomRendererMetaData&gt;&gt; _rendererImports = new List&lt;Lazy&lt;ICustomRenderer, ICustomRendererMetaData&gt;&gt;();
  
      private readonly Dictionary&lt;string, Lazy&lt;ICustomRenderer, ICustomRendererMetaData&gt;&gt; _renderers;
  
      public static readonly FormPartCustomatorFactory Instance = new FormPartCustomatorFactory();
  
      static CompositionContainer _container;
  
      private FormPartCustomatorFactory()
      {
          using (var catalog = new DirectoryCatalog(HttpRuntime.BinDirectory, "*.dll"))
          {               
              _container = new CompositionContainer(catalog);
              _container.SatisfyImportsOnce(this); // &lt;- Works
              // _container.ComposeParts(this); // DOESN'T Work
              _renderers = _rendererImports.ToDictionary(q =&gt; q.Metadata.Name, q =&gt; q);
          }
      }
  
      ~FormPartCustomatorFactory()
      {
          _container.Dispose();
      }
  
      public static ICustomRenderer Find(string name)
      {
          return Instance._renderers[name].Value;
      }
  }
  </code></pre>