Ninject.Extensions.DependencyInjection
1.0.0-beta
This is a prerelease version of Ninject.Extensions.DependencyInjection.
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package Ninject.Extensions.DependencyInjection --version 1.0.0-beta
NuGet\Install-Package Ninject.Extensions.DependencyInjection -Version 1.0.0-beta
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" Version="1.0.0-beta" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Ninject.Extensions.DependencyInjection --version 1.0.0-beta
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Ninject.Extensions.DependencyInjection, 1.0.0-beta"
#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 as a Cake Addin #addin nuget:?package=Ninject.Extensions.DependencyInjection&version=1.0.0-beta&prerelease // Install Ninject.Extensions.DependencyInjection as a Cake Tool #tool nuget:?package=Ninject.Extensions.DependencyInjection&version=1.0.0-beta&prerelease
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
This repo is based on https://github.com/lord-executor/Ninject.Web.AspNetCore which has the original work.
Overview
This project provides full Ninject integration with ASP.NET Core projects. Full integration means that the Ninject kernel is used to replace the standard service provider that comes with ASP.NET Core.
- Ninject.Extensions.DependencyInject
- Ninject.Extensions.DependencyInjection.AspNetCore - this is only required if you use
.InRequestScope()
.
Examples
Simple Program.cs
using Microsoft.AspNetCore.Builder;
using Ninject.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Ninject;
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().ConfigureAwait(false);
With Startup.cs file
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. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net5.0
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 5.0.0)
- Ninject (>= 3.3.6)
-
net6.0
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 6.0.0)
- Ninject (>= 3.3.6)
-
net7.0
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 7.0.0)
- Ninject (>= 3.3.6)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Ninject.Extensions.DependencyInjection:
Package | Downloads |
---|---|
Ninject.Extensions.DependencyInjection.AspNetCore
Package Description |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
1.0.2 | 22,896 | 8/2/2023 |
1.0.1-beta | 173 | 7/31/2023 |
1.0.0-beta | 149 | 7/29/2023 |