Ninject: Abstract Class


Ninject: Abstract Class



Do I need to do something different in an abstract class to get dependency injection working with Ninject?

I have a base controller with the following code:

public abstract class BaseController : Controller {     public IAccountRepository AccountRepository     {         get;         set;     } } 

My module looks like this:

public class WebDependencyModule : NinjectModule {     public override void Load()     {         Bind<IAccountRepository>().To<AccountRepository>();     } } 

And this is my Global.asax:

protected override void OnApplicationStarted() {     Kernel.Load(new WebDependencyModule()); }  protected override IKernel CreateKernel() {     return new StandardKernel(); } 

It works when I decorate the IAccountRepository property with the [Inject] attribute.


Using ASP.Net MVC Data Annotation outside of MVC

1:

twitter like alert jquery in asp.net mvc
Not sure what you're endeavor to do.. How to disable Export to Microsoft Excel in the IE browser right click? It looks like you want to did Property Injection. Detect if an element is selected in listbox or not through jqueryIf so, you have to stick on the attrialthough e.. asp.net mvc jquery how to enable the button after disable Ninject doesnt randomly go sticking things in properties.. Creating Database Mocks in ASP.NET MVC using Data from Existing Database Even if it could, you wonldnt want it to from the point of view of endeavor to understand what depends on what (I've weaned myself completely off PI).. Is it possible to configure ELMAH entirely in code? If you want to did constructor injection, the concrete Controller will need to ask for one and pass it down to 'BaseController'.. How to design configurable MVC panels? Ninject will walk through to Object and inject Attrialthough ed properties, although doesnt treat abstract classes in any special manner.. Either this or I'm missing any thing..


86 out of 100 based on 41 user ratings 396 reviews

#