I want to implement IoC container using ASP.NET web forms. I'm completed these steps:
- Install - Ninjectand- Ninject.Webddl
- public class Global : NinjectHttpApplication
- Create - Kernel- public override IKernel CreateKernel() { IKernel kernel = new StandardKernel(new Module.Module()); return kernel; }
- Create - Module- public override void Load() { Bind<IMetricService>().To<MetricService>(); }
- Using Inject on - Page- public partial class _Default : Page { [Inject] private IMetricService metricService; protected void Page_Init(object sender,EventArgs e) { metricService = new MetricService(metricService); } protected void Page_Load(object sender, EventArgs e) { metricService.GetAllMetrics(); } }
And this is my MetricService class
 public class MetricService : IMetricService
 {
        [Inject]
        private IMetricService _metricService;
        public MetricService(IMetricService metricService)
        {
            this._metricService = metricService;
        }
        public void GetAllCriteria()
        {
            _metricService.GetAllCriteria();
            Console.WriteLine("metric service");
        }
 }
As I understand when pass the IMetricService in MetricService constructor the IoC container must bind this MetricService class. I think my mistake is general but I can't understand where.
 
     
    