title: ASP.NET MEF Compose all class parts
body: <pre><code>    // In Global asax
  
      DirectoryCatalog catalog = new DirectoryCatalog(System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "bin"));
  
      CompositionContainer container = new CompositionContainer(catalog);
  
     // do not want to compose at every instance when use Import attribute.
      container.ComposeParts(this);
  
      // add all external library (.dll)
      container.ComposeParts(container);
  
  
      // Index.aspx page
      public partial Index: Page{
  
      [Import]
      private c1 object1;
  
      protected void OnLoadPage
      {
          if (object1== null)
             thrown Error("mef failed, why")
      }
  
      }
  
  
      // External library Library1
      [Export(typeOf(c1))]
      public class c1{}
  
      // External library Library2
      [Export(typeOf(c2))]
      public class c2{}
  </code></pre>
  
  <p><strong>why object1 is null?</strong></p>
  
  <p>How to compose all classes from Global asax or simple to make some asp.net bootstrap lazy loading?</p>
  
  <p>I do not want in every constructor to compose part. How to make all assembly or classes to be compose at the beginning in Global asax? All my [Export] are in external library classes. Main site project have reference to all .dll projects.</p>
  
  <p>I am not sure the my question is correct, sorry for that.</p>
  
  <p>Project is simple asp.net (no MVC) with external library with user controls.</p>