Monday, August 1, 2016

Using Ninject Extensions Conventions

If you are using Ninject, you may find yourself duplicating a lot of code for binding interfaces to their respective classes.

Fortunately, Ninject has a NuGet package which can take a lot of that tedious work away and bind interfaces to classes automatically!

The name of the Ninject package is called Ninject.Extensions.Conventions:



Once you have installed the NuGet package, you can add the following code to the RegisterServices method of your NinjectWebCommon.cs file:


That is all that is needed to get your Ninject project up and running!

No comments:

Post a Comment