0

Following this question asked here: Ninject in .NET Core

I can't find anywhere an explanation of how to configure ninject in a .NET Core application.

I understand its done in the public void ConfigureServices(IServiceCollection services)

Did anyone successfully accomplished that?

omriman12
  • 1,644
  • 7
  • 25
  • 48

1 Answers1

1

I have never personally used Ninject, but the common way to use custom IoC containers in netcore is to change the return type of the ConfigureServices method from void to IServiceProvider. In case of Ninject it would look like this:

    public IServiceProvider ConfigureServices(IServiceCollection services)
    {
        var kernel = new StandardKernel();

        // register your modules here

        return kernel;
    }

...I have just tried it and it works, because the StandardKernel of Ninject implements the IServiceProvider interface of netcore.

Igors Sutovs
  • 131
  • 5