Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Convention based binding for Ninject
C# Batchfile
Failed to load latest commit information.
lib Added support for the factory extension
nuget Update release notes and nuget spec
src Fix doc comment typos
tools Updated build script to mono 3.4
.gitignore Added assembly description for nuget
HowToBuild.txt Updated How to Build - Reference teamcity.bbv.ch instead of codebetter
LICENSE.txt Adding project files from ninject fork.
Ninject.Extensions.Conventions - With SL and WP7 Unittests.sln Added the feature that multiple configurations can be done in one Bin…
Ninject.Extensions.Conventions.build Added mono settings to test compilation.
Ninject.Extensions.Conventions.sln Update ReleaseNotes
Ninject.Extensions.Conventions.sln.docstates Added the feature that multiple configurations can be done in one Bin…
Ninject.build Revert "Changed the build scripts that WP7 Uni Tests are not executed…
Ninject.include Updated build script to mono 3.4
README.md Update README.md
ReleaseNotes.md Update ReleaseNotes
UnzipDependencies.cmd Improved Build scripts to allow the creation of zip files with a spec…
build-alpha.cmd Updated to Nuget 1.6 and added support for prerelease packages
build-beta.cmd Updated to Nuget 1.6 and added support for prerelease packages
build-rc1.cmd Updated to Nuget 1.6 and added support for prerelease packages
build-release.cmd Updated to NuGet 1.3
build.cmd Updated to the common build script files

README.md

Ninject.Extensions.Conventions NuGet Version NuGet Downloads

Provides a configuration by convention extension for Ninject.

Sample uses

Binding default single interface

IKernel kernel = new StandardKernel();

kernel.Bind(x =>
    {
        x.FromThisAssembly() // Scans currently assembly
         .SelectAllClasses() // Retrieve all non-abstract classes
         .BindDefaultInterface(); // Binds the default interface to them;
    });

Default interface in this scenario means that if your interface is named IService, then the class named Service will be binded to it. However, the class SqlBasedService will not be binded and will fail to retrieve the implementation.

Binding single interface

IKernel kernel = new StandardKernel();

kernel.Bind(x =>
    {
        x.FromThisAssembly() // Scans currently assembly
         .SelectAllClasses() // Retrieve all non-abstract classes
         .BindSingleInterface(); // Binds the default interface to them;
    });

Binding single interface means that you are expecting to have one implementation per classes found. This would bind SqlBasedService to IService as well as Service to IService but would not bind SqlBasedService and Service to an IService.

You can find more details in wiki page.

CI build status

Build Status

Something went wrong with that request. Please try again.