Ninject.Extensions.DependencyInjection.AspNetCore
1.0.2
dotnet add package Ninject.Extensions.DependencyInjection.AspNetCore --version 1.0.2
NuGet\Install-Package Ninject.Extensions.DependencyInjection.AspNetCore -Version 1.0.2
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Ninject.Extensions.DependencyInjection.AspNetCore" Version="1.0.2" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Ninject.Extensions.DependencyInjection.AspNetCore --version 1.0.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Ninject.Extensions.DependencyInjection.AspNetCore, 1.0.2"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Ninject.Extensions.DependencyInjection.AspNetCore as a Cake Addin #addin nuget:?package=Ninject.Extensions.DependencyInjection.AspNetCore&version=1.0.2 // Install Ninject.Extensions.DependencyInjection.AspNetCore as a Cake Tool #tool nuget:?package=Ninject.Extensions.DependencyInjection.AspNetCore&version=1.0.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Ninject.Extensions.DependencyInjection
Overview
This repo is based on https://github.com/lord-executor/Ninject.Web.AspNetCore which has the original work.
This project provides full Ninject integration with .NET Core projects. This integrates .NET Core service collection with the Ninject kernel and uses Ninject's kernel as the service provider.
- Ninject.Extensions.DependencyInjection
- Ninject.Extensions.DependencyInjection.AspNetCore - this is only required if you use
.InRequestScope()
.
Examples
Simple Program.cs
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Ninject;
using Ninject.Extensions.DependencyInjection;
var builder = WebApplication.CreateBuilder(args);
builder.Host
.UseServiceProviderFactory(new NinjectServiceProviderFactory())
.ConfigureContainer<IKernel>(kernel =>
{
// Ninject Binding here
// kernel.Bind<IServiceA>().To<ServiceA>();
});
// ServiceCollection Binding here
// builder.Services
// .AddTransient<IServiceB, ServiceB>();
builder.Services.AddMvc();
var app = builder.Build();
app.UseRouting()
.UseEndpoints(endpoints => endpoints.MapControllers());
await app.RunAsync();
With Startup.cs file
Program.cs
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Hosting;
using Ninject.Extensions.DependencyInjection;
var builder = Host.CreateDefaultBuilder(args);
builder
.UseServiceProviderFactory(new NinjectServiceProviderFactory())
.ConfigureWebHostDefaults(webBuilder => webBuilder.UseStartup<Startup>());
var app = builder.Build();
await app.RunAsync().ConfigureAwait(false);
Startup.cs
public class Startup
{
public static void Configure(IApplicationBuilder app)
{
app.UseRouting()
.UseEndpoints(endpoints => endpoints.MapControllers());
}
public static void ConfigureServices(IServiceCollection services)
{
// ServiceCollection Binding here
// builder.Services
// .AddTransient<IServiceB, ServiceB>();
services.AddMvc();
}
public static void ConfigureContainer(IKernel builder)
{
// Ninject Binding here
// kernel.Bind<IServiceA>().To<ServiceA>();
}
}
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 is compatible. net5.0-windows was computed. net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net5.0
- Ninject.Extensions.DependencyInjection (>= 1.0.2)
- Ninject.Web.Common (>= 3.3.2)
-
net6.0
- Ninject.Extensions.DependencyInjection (>= 1.0.2)
- Ninject.Web.Common (>= 3.3.2)
-
net7.0
- Ninject.Extensions.DependencyInjection (>= 1.0.2)
- Ninject.Web.Common (>= 3.3.2)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
1.0.2 | 298 | 8/2/2023 |
1.0.1-beta | 144 | 7/31/2023 |
1.0.0-beta | 140 | 7/29/2023 |