title: Simple Injector property injection on action filter
body: <p>The action filter I want to inject into starts like this</p>
  
  <pre><code>public class UserAuthorisation : AuthorizeAttribute
  {
      public IWcfClientProxy&lt;IAppFrameworkServiceChannel&gt;
          FrameworkServiceProxy { get; set; }
  </code></pre>
  
  <p>I have setup my container like this:</p>
  
  <pre><code>container.Register&lt;IWcfClientProxy&lt;IAppFrameworkServiceChannel&gt;&gt;(
      ()=&gt; new WcfClientProxy&lt;IAppFrameworkServiceChannel&gt;());
  
  container.RegisterInitializer&lt;UserAuthorisation&gt;(handler =&gt;
  {
      handler.FrameworkServiceProxy = container
         .GetInstance&lt;IWcfClientProxy&lt;IAppFrameworkServiceChannel&gt;&gt;();
  });
  </code></pre>
  
  <p>When I run this the <code>FrameworkServiceProxy</code> property is null.</p>
  
  <p>I have read this post: <a href="https://stackoverflow.com/questions/6227074/simple-injector-injecting-a-property-in-a-base-class">Simple Injector: Injecting a property in a base class</a> and followed the answer. I have also read example in this page <a href="http://simpleinjector.codeplex.com/wikipage?title=Using%20the%20Simple%20Injector&amp;referringTitle=Documentation" rel="nofollow noreferrer">Simple Injector Documentation</a>.</p>
  
  <p>I am not injecting into a base class and maybe that is the issue? </p>
  
  <h3>## UPDATE ##</h3>
  
  <p>I am adding more information as I think it should be working from what has been said in Stevens answer.</p>
  
  <p>I am using the NuGet package for MVC 3. This adds the following to the application:</p>
  
  <pre><code>public static class SimpleInjectorInitializer
  {
      /// &lt;summary&gt;Initialize the container and register it as MVC3 Dependency Resolver.&lt;/summary&gt;
      public static void Initialize()
      {
          var container = new Container();
          InitializeContainer(container);
          container.RegisterMvcControllers(Assembly.GetExecutingAssembly());
          container.RegisterMvcAttributeFilterProvider();
          container.Verify();
          DependencyResolver.SetResolver(new SimpleInjectorDependencyResolver(container));
      }
  
      private static void InitializeContainer(Container container)
      {
          container.Register&lt;IWcfClientProxy&lt;IAppFrameworkServiceChannel&gt;&gt;(() =&gt; new WcfClientProxy&lt;IAppFrameworkServiceChannel&gt;());
          container.RegisterInitializer&lt;UserAuthorisation&gt;(handler =&gt;
              {
                  handler.FrameworkServiceProxy = container.GetInstance&lt;IWcfClientProxy&lt;IAppFrameworkServiceChannel&gt;&gt;();
              });
      }
  </code></pre>
  
  <p>This includes the <code>container.RegisterMvcAttributeFilterProvider();</code> that as I now understand it should register a filter provider and should mean that filters are created through the container (this understanding might be wrong) and then properties are automatically wired-up.</p>
  
  <p>My filter is registered in the Global.asax.cs like so:</p>
  
  <pre><code>public static void RegisterGlobalFilters(GlobalFilterCollection filters)
  {
      filters.Add(new HandleErrorAttribute());
      filters.Add(new UserAuthorisation());
  }
  </code></pre>
  
  <p>It seems to me that the filter is not being created by the container so I think I need to do something else to get that to happen ?</p>