For all of you tired of creating cumbersome ASP.Net providers and struggling with App.config, a lightweight yet powerful dependency injection for .Net: Ninject. This is an example how the injection works with properties:

 

class Samurai {
  private IWeapon _weapon;

[Inject] public IWeapon Weapon { get { return _weapon; } set { _weapon = value; } }

public void Attack(string target) { _weapon.Hit(target); } }

Hope you will enjoy it!

2

Comments

Have not tried it yet, but ran into this article which explains how to easily integrate Ninject with ASP.NET MVC.