Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
the ninja of .net dependency injectors
C# Batchfile

This branch is even with ninject:master

Merge pull request #142 from onovotny/bait-switch

This is a fresh PCL implementation using the "Bait & Switch" technique
latest commit d1660fb7f4
@scott-xu scott-xu authored
Failed to load latest commit information.
.nuget Update nuget and android pkgs
RemotingServer Changed the InstanceReference to look for interfaces based on type if…
RemotingTestClient Changed the InstanceReference to look for interfaces based on type if…
lib Use Nuget packages instead of lib folder
logos Updated to the latest build scripts
nuget Update Ninject.nuspec
packages Update to latest Fluent Assertions; add Android test project
src Convert to .net 4.5.1, win 8.1; remove sl5 and wp8
tools Convert to .net 4.5.1, win 8.1; remove sl5 and wp8
.gitignore Convert to .net 4.5.1, win 8.1; remove sl5 and wp8
Build-NinjectAndExtensions.bat Improved releasing scripts
Build-NinjectAndExtensionsWithReleaseTag.bat Added .Net 4.5, SL5 and WP 7.1 builds
HowToBuild.txt Removed target which are not supported anymore.
LICENSE.txt Updated licensing terms to reflect dual-license with Ms-PL
Ninject.build Removed target which are not supported anymore.
Ninject.include Removed target which are not supported anymore.
Ninject.sln Convert to .net 4.5.1, win 8.1; remove sl5 and wp8
Ninject.sln.DotSettings Added StyleCop settings file and resharper solution settings file.
Portable.CommonServiceLocator.NinjectAdapter.nuspec Update csl and create release
Portable.Ninject.nuspec Convert to .net 4.5.1, win 8.1; remove sl5 and wp8
PushAllGoogleCode.bat Added NuGet only push Nuget and Google code scripts
PushAllGoogleCode.build Added NuGet only push Nuget and Google code scripts
PushAllNuGet.bat Added NuGet only push Nuget and Google code scripts
PushAllNuget.build Added NuGet only push Nuget and Google code scripts
PushGoogleCode.bat Improved releasing scripts
PushGoogleCode.build Added NuGet only push Nuget and Google code scripts
PushNuGet.bat Added NuGet only push Nuget and Google code scripts
PushNuGet.build Added NuGet only push Nuget and Google code scripts
README.md Update README.md
ReleaseNotes.md Merge branch 'readonlykernel'
UnzipDependencies.cmd Fixed that the wrong error message is shown when there are multiple b…
build-alpha.cmd Added batch files to create pre release nuget packages
build-beta.cmd Added batch files to create pre release nuget packages
build-rc1.cmd Added batch files to create pre release nuget packages
build-release.cmd Changed build script that WP7 UniTests are not executed on Windows 8
build.cmd Make it build again using script
nuget.config Update to latest xUnits
pack.cmd Make it build again using script

README.md

Ninject NuGet Version NuGet Downloads

Ninject is a lightning-fast, ultra-lightweight dependency injector for .NET applications. It helps you split your application into a collection of loosely-coupled, highly-cohesive pieces, and then glue them back together in a flexible manner. By using Ninject to support your software's architecture, your code will become easier to write, reuse, test, and modify.

Write your code so it's flexible...

public class Samurai {
    public IWeapon Weapon { get; private set; }
    public Samurai(IWeapon weapon) 
    {
        this.Weapon = weapon;
    }
}

...and let Ninject glue it together for you.

public class WarriorModule : NinjectModule
{
    public override void Load() 
    {
        this.Bind<IWeapon>().To<Sword>();
    }
}

Features:

  1. Focused. Too many existing dependency injection projects sacrifice usability for features that aren't often necessary. Each time a feature is added to Ninject, its benefit is weighed against the complexity it adds to everyday use. Our goal is to keep the barrier to entry - the baseline level of knowledge required to use Ninject - as low as possible. Ninject has many advanced features, but understanding them is not required to use the basic features.

  2. Sleek. Framework bloat is a major concern for some projects, and as such, all of Ninject's core functionality is in a single assembly with no dependencies outside the .NET base class library. This single assembly's footprint is approximately 85KB when compiled for release.

  3. Fast. Instead of relying on reflection for invocation, Ninject takes advantage of lightweight code generation in the CLR. This can result in a dramatic (8-50x) improvement in performance in many situations.

  4. Precise. Ninject helps developers get things right the first time around. Rather than relying on XML mapping files and string identifiers to wire up components, Ninject provides a robust domain-specific language. This means that Ninject takes advantage of the capabilities of the language (like type-safety) and the IDE (like IntelliSense and code completion).

  5. Agile. Ninject is designed around a component-based architecture, with customization and evolution in mind. Many facets of the system can be augmented or modified to fit the requirements of each project.

  6. Stealthy. Ninject will not invade your code. You can easily isolate the dependency on Ninject to a single assembly in your project.

  7. Powerful. Ninject includes many advanced features. For example, Ninject is the first dependency injector to support contextual binding, in which a different concrete implementation of a service may be injected depending on the context in which it is requested.

Everything else is in Extensions

Yes, sounds slim and focused, but where is the support for all the features that the competitors have?

Generally, they are maintained as specific focused extensions with owners who keep them in sync and pull in new ideas and fixes fast. These are summarized on the extensions section of the project website. Most are hosted alongside the core project right here.

License

Ninject is intended to be used in both open-source and commercial environments. To allow its use in as many situations as possible, Ninject is dual-licensed. You may choose to use Ninject under either the Apache License, Version 2.0, or the Microsoft Public License (Ms-PL). These licenses are essentially identical, but you are encouraged to evaluate both to determine which best fits your intended use.

Refer to LICENSE.txt for detailed information.

CI build status

Build Status

Changes history

Resources

Something went wrong with that request. Please try again.