title: Multiple applications working in one 'shell'
body: <p>I am trying to use MEF to do this, but maybe I am using the wrong technology.</p>
  
  <p>I have 2 applications(both are more ideas right now) One is a desktop application that I am converting to Silverlight. The other is just an idea that fits into the same structure. I want to take both applications as individual self contained applications and run them from within a shell site. I have been trying to start this with MEF, but I dont know enough about it yet in order to know whether I am doing something wrong, or its not the right technology.</p>
  
  <p>Currently I am using MVVM-light as my framework, I have had great success with this and am pretty familiar with it by now. Each of my applications are selfcontained...meaning that I can use them by themself If i set them to run from my webserver standalone.</p>
  
  <p>The problem comes when I try to get them into my shell using mef. </p>
  
  <p>This is the code for my first modulecontainer:</p>
  
  <pre><code>public partial class MEFDoctorsModuleContainer : Page, IPartImportsSatisfiedNotification
      {
          private System.Uri _requestedUri;
  
          public MEFDoctorsModuleContainer()
          {
              InitializeComponent();
  
          }
  
          [Import]
          public IDeploymentCatalogService CatalogService { get; set; }
  
          [ImportMany(AllowRecomposition = true)]
          public Lazy&lt;UserControl, IMetadataContent&gt;[] MEFModuleList { get; set; }
  
          // Executes when the user navigates to this page.
          protected override void OnNavigatedTo(NavigationEventArgs e)
          {
              _requestedUri = e.Uri;
  
              CompositionInitializer.SatisfyImports(this);
          }
  
  
          public void OnImportsSatisfied()
          {
              CatalogService.AddXap("WavelengthIS.Referee.PhysicianMaster.xap");
  
              //MEFModuleList.ToList()
              //       .ForEach(module =&gt;
              //       {
              //           if ((module.Metadata.ContainerType == this.GetType().ToString() &amp;&amp;
              //               (module.Value.GetType().ToString() == "WavelengthIS.Referee.PhysicianMaster.MainPage.xaml")))
              //           {
              //               content.Items.Add(module.Value);
              //           }
              //       });
  
              MEFModuleList.ToList()
                    .ForEach(delegate(Lazy&lt;UserControl, IMetadataContent&gt; module)
                             {
                                 if ((module.Metadata.ContainerType == this.GetType().ToString() &amp;&amp; (module.Value.GetType().ToString() == "WavelengthIS.Referee.PhysicianMaster.App.xaml")))
                                     content.Items.Add(module.Value);
                             });
          }
      }
  }
  </code></pre>
  
  <p>Right now the xap consists of only one Project, but eventually it will consist of my Data,ViewModel, and service projects for the client. But even then it crashes. It doesnst seem to like the viewmodellocator. </p>
  
  <pre><code>(module.Value.GetType().ToString() == "WavelengthIS.Referee.PhysicianMaster.App.xaml")))
  </code></pre>
  
  <p>used to equal this</p>
  
  <pre><code>(module.Value.GetType().ToString() == "WavelengthIS.Referee.PhysicianMaster.MainPage.xaml")))
  </code></pre>
  
  <p>But I was thinking that this wouldnt work, because I am actually importing an application and not just a page. </p>
  
  <p>so my question is this: <strong>Given what I am trying to do what are my best options to make this work?</strong></p>
  
  <p>I am not stuck on MEF, But I do require a Shell application that loads the standalones into it using a navigation framework that is in SL4. I require that MVVM-Light works because I like that framework alot and even though i have written MVVM Enterprise apps without it, I prefer to have it in my bag of tricks. I dont like hocus pocus...IOC and Dependency Injection are off the table because I am not comfortable using that technology yet and If I need to use it Ill find some other way to do this.</p>