using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Ninject;
using MvcApplication1.Controllers;
namespace MvcApplication1
{
public class NinjectDependencyResolver
:System.Web.Mvc.IDependencyResolver
{
private Ninject.IKernel kernel;
public NinjectDependencyResolver()
{
this.kernel = new Ninject.StandardKernel();
this.AddBindings();
}
private void AddBindings()
{
this.kernel.Bind<IMessageProvider>()
.To<NinjectMessageProvider>();
}
public object GetService(Type serviceType)
{
return this.kernel.TryGet(serviceType);
}
public IEnumerable<object> GetServices(Type serviceType)
{
return this.kernel.GetAll(serviceType);
}
}
}