• Stars
    star
    2,633
  • Rank 16,689 (Top 0.4 %)
  • Language
    C#
  • License
    Other
  • Created about 15 years ago
  • Updated 10 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

the ninja of .net dependency injectors

Ninject

Build status codecov 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.

Changes history

Resources

More Repositories

1

Ninject.Web.Mvc

extension for ninject providing integration with ASP.NET MVC
C#
242
star
2

Ninject.Extensions.Wcf

Ninject WCF extensions
C#
81
star
3

Ninject.Extensions.Conventions

Convention based binding for Ninject
C#
76
star
4

Ninject.MockingKernel

Extension for Ninject aiding testability in Moq, NSubstitute, and FakeItEasy
C#
63
star
5

Ninject.Extensions.Logging

Ninject logging extensions
C#
62
star
6

Ninject.Extensions.Interception

Interception extension for Ninject
C#
58
star
7

Ninject.Web.Common

It provides the base infrastructure for all web type extension
C#
55
star
8

Ninject.Extensions.Factory

Creates factory implementations automatically
C#
39
star
9

Ninject.Web

Ninject ASP.NET Framework
C#
31
star
10

ninject1

the original version of ninject, the ninja of .net dependency injectors
C#
20
star
11

Ninject.Extensions.Xml

xml-based module loader for ninject
C#
16
star
12

Ninject.Extensions.NamedScope

This extension allows that bindings can define scopes. All dependencies can now define that they want to use this instance as their scope.
C#
16
star
13

Ninject.Extensions.ChildKernel

This Ninject extension allows that child kernels can be defined.
C#
14
star
14

Ninject.Web.Mvc.FluentValidation

Fluent validation extension for ninject.web.mvc
Batchfile
13
star
15

ninject.website

the ninject website
C#
13
star
16

Ninject.Extensions.Wf

Ninject extension for Windows Workflow Foundation 4
C#
13
star
17

Ninject.Extensions.WeakEventMessageBroker

Message broker extension for Ninject using weak events
C#
10
star
18

Ninject.Extensions.ContextPreservation

This extension preserves the context over such factories. That means the parent of the new request is the factory request.
C#
9
star
19

Ninject.Extensions.MessageBroker

Message broker extension for Ninject
C#
9
star
20

Ninject.Extensions.Azure

Adds support for role injection
C#
8
star
21

Ninject.Extensions.DependencyCreation

This module is used to create a dependency toghether with another object without having a reference to it.
C#
6
star
22

Ninject.Extensions.BbvEventBroker

This extension adds support for bbv.Common.EventBroker.
C#
4
star
23

ninject.github.com

JavaScript
2
star