title: Property Injection in Base Controller using Ninject 2
body: <p>I have the following code in my Global.aspx</p>
  
  <pre><code>protected override void OnApplicationStarted()
  {
      AreaRegistration.RegisterAllAreas();
      RegisterRoutes(RouteTable.Routes);
      RegisterAllControllersIn(Assembly.GetExecutingAssembly());
  }
  
  protected override IKernel CreateKernel()
  {
      return new StandardKernel(new ServiceModule());
  }
  </code></pre>
  
  <p>I also have the following Ninject Module:</p>
  
  <pre><code>internal class ServiceModule : NinjectModule
  {
      public override void Load()
      {
          Bind&lt;IProductService&gt;().To&lt;ProductService&gt;().InRequestScope();
      }
  }
  </code></pre>
  
  <p>I also have a base controller:</p>
  
  <pre><code>public class BaseController : Controller
  {
      [Inject]
      public IProductService ProductService
      {
          get;
          set;
      }
  }
  </code></pre>
  
  <p>This code works. The problem I am having is that I would like to remove the inject attribute from the base controller and specify this in the Ninject ServiceModule instead. I other words, how would I go about writing a binding rule in the ServiceModule that tells Ninject to inject ProductService into the property in the base controller?</p>
  
  <p>If I remove the attribute I will get a NullReferenceException.</p>