title: Import aspect is not working using MEF
body: <p>using mefcontrib.mvc3 on my mvc web application. used following class for initialize mef before application start event. That class is auto generated(downloaded) from nuget. some tiny changes applied for catalog(for plugins folder) and controller factory segments.</p>
  
  <pre><code>[assembly: WebActivator.PreApplicationStartMethod(typeof(OMR.CMS.App_Start.MefContribMVC3), "Start")]
  
  namespace OMR.CMS.App_Start
  {
      using System.ComponentModel.Composition.Hosting;
      using System.Linq;
      using System.Web.Mvc;
      using MefContrib.Hosting.Conventions;
      using MefContrib.Web.Mvc;
  
      public static class MefContribMVC3
      {
          public static void Start()
          {
              // Register the CompositionContainerLifetimeHttpModule HttpModule.
              // This makes sure everything is cleaned up correctly after each request.
              CompositionContainerLifetimeHttpModule.Register();
  
              // Create MEF catalog based on the contents of ~/bin.
              //
              // Note that any class in the referenced assemblies implementing in "IController"
              // is automatically exported to MEF. There is no need for explicit [Export] attributes
              // on ASP.NET MVC controllers. When implementing multiple constructors ensure that
              // there is one constructor marked with the [ImportingConstructor] attribute.
              var catalog = new AggregateCatalog(
                  //new DirectoryCatalog("bin"),
                  new DirectoryCatalog("Plugins"),
                  new ConventionCatalog(new MvcApplicationRegistry())); // Note: add your own (convention)catalogs here if needed.
  
              // Tell MVC3 to use MEF as its dependency resolver.
              var dependencyResolver = new CompositionDependencyResolver(catalog);
              DependencyResolver.SetResolver(dependencyResolver);
  
              // Tell MVC3 to resolve dependencies in controllers
              ControllerBuilder.Current.SetControllerFactory(new MyMEFControllerFactory(dependencyResolver));
  
              // Tell MVC3 to resolve dependencies in filters
              FilterProviders.Providers.Remove(FilterProviders.Providers.Single(f =&gt; f is FilterAttributeFilterProvider));
              FilterProviders.Providers.Add(new CompositionFilterAttributeFilterProvider(dependencyResolver));
  
              // Tell MVC3 to resolve dependencies in model validators
              ModelValidatorProviders.Providers.Remove(ModelValidatorProviders.Providers.OfType&lt;DataAnnotationsModelValidatorProvider&gt;().Single());
              ModelValidatorProviders.Providers.Add(
                  new CompositionDataAnnotationsModelValidatorProvider(dependencyResolver));
  
              // Tell MVC3 to resolve model binders through MEF. Note that a model binder should be decorated
              // with [ModelBinderExport].
              ModelBinderProviders.BinderProviders.Add(
                  new CompositionModelBinderProvider(dependencyResolver));
          }
      }
  }
  </code></pre>
  
  <p>and using followin code on my application class:</p>
  
  <pre><code>using OMR.Core.Web.Filters;
  using OMR.Core.Web.Routing;
  using System;
  using System.Collections.Generic;
  using System.ComponentModel.Composition;
  using System.Web.Mvc;
  using System.Web.Optimization;
  using System.Web.Routing;
  
  namespace OMR.CMS
  {
      public class MvcApplication : System.Web.HttpApplication
      {
          [ImportMany(typeof(IFilterRegistration))]
          public IEnumerable&lt;Lazy&lt;IFilterRegistration&gt;&gt; Filters { get; set; }
  
          protected void Application_Start()
          {
              AreaRegistration.RegisterAllAreas();
  
              BundleConfig.RegisterBundles(BundleTable.Bundles);
  
              RegisterFilters();
              RegisterRoutes();
          }
  
          private void RegisterFilters()
          {
              var filters = GlobalFilters.Filters;
              var filterRegistrations = DependencyResolver.Current.GetServices&lt;IFilterRegistration&gt;();
  
              foreach (var registar in filterRegistrations)
                  registar.Register(filters);
          }
  
          public void RegisterRoutes()
          {
              var routes = RouteTable.Routes;
              var routeRegistrations = DependencyResolver.Current.GetServices&lt;IRouteRegistration&gt;();
  
              // Ignores
              foreach (var registrar in routeRegistrations)
                  registrar.Ignore(routes);
  
              // Routes
              foreach (var registrar in routeRegistrations)
                  registrar.Route(routes);
          }
      }
  }
  </code></pre>
  
  <p>The problem is following property is currently null on application start method. </p>
  
  <pre><code>ImportMany(typeof(IFilterRegistration))]
  public IEnumerable&lt;Lazy&lt;IFilterRegistration&gt;&gt; Filters { get; set; }
  </code></pre>
  
  <p>But following lines is working:</p>
  
  <pre><code>var filterRegistrations = DependencyResolver.Current.GetServices&lt;IFilterRegistration&gt;();
  </code></pre>
  
  <p>Why my import declaration isn't work?</p>