Ninject Global asax ASP.NET MVC 3 not working

41 views Asked by At

I have the code on my global.asax.cs

public class WebApiApplication : NinjectHttpApplication
{

    protected override void OnApplicationStarted()
    {
        base.OnApplicationStarted();

        AreaRegistration.RegisterAllAreas();
        GlobalConfiguration.Configure(WebApiConfig.Register);
        FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
        RouteConfig.RegisterRoutes(RouteTable.Routes);
        BundleConfig.RegisterBundles(BundleTable.Bundles);
    }

    protected override IKernel CreateKernel()
    {
        var kernel = new StandardKernel();
        kernel.Load(Assembly.GetExecutingAssembly());

        kernel.Bind<IMediator>().To<Mediator>().InRequestScope();
        kernel.Bind<SipUnitOfWork>().To<SipUnitOfWork>().InSingletonScope();
        kernel.Bind<IPremissaSimulacaoService>().To<PremissaSimulacaoService>().InSingletonScope();

        return kernel;
    }
}

But, on My Controller I have:

    private readonly IMediator _mediator;

    public SimulacaoController(IMediator mediator)
    {
        _mediator = mediator;
    }

My Web Application returns error:

"The Type" 'MyController' doesnt a default constructor

0

There are 0 answers