52

I want to get started using Dependency Injection and IOC and I want to get more into using Ninject.

Are there any good application with sourcecode available that is written using Ninject that I can look at as a reference?

7 Answers7

47

Shameless plug: I have put together a very basic tutorial to get started with Ninject. Have a look at Ninject Mini-Tutorial Part1 and Ninject Mini-Tutorial Part2. That should help go get you started.

There you can find a reference to the source code on Github.

Stefano Ricciardi
  • 2,923
  • 3
  • 33
  • 40
8

Ninject can be used with various types of Applications. It could be an ASP.NET WebForms application, ASP.NET MVC application or others.

For a detailed (with screenshots) step-by-step tutorial (with sample application to download) have a look at the following in addition to the Ninject "dojo" walkthrough that bryanray has mentioned.

http://peakbyte.wordpress.com/2009/09/28/how-to-use-ninject-ioc-with-asp-net-mvc/

Please note that this tutorial was written when ASP.NET MVC 2.0 was NOT released. Tiny modifications would be needed to get it working with ASP.NET MVC 2.0, like obtaining the appropriate Ninject.Framework.MVC.dll

Mani
  • 307
  • 1
  • 4
  • 8
4

Also take a look at these screencasts in DimeCast. Good starter.

muruge
  • 4,083
  • 3
  • 38
  • 45
3

The Ninject "dojo" has a great walk through for getting started as well.

Update: The link that was initially provided was no longer valid. All the current documentation can be found on the Github wiki: http://wiki.github.com/ninject/ninject - Thanks, Martin.

Bryan Ray
  • 931
  • 10
  • 26
  • 1
    I perfectly know IoC from PicoContainer, however I just can't make the simplest thing in NInject work. Can someone provide 10-line console project where things work? Specifically using [Inject] attribute. – Ivan G. May 20 '10 at 08:54
  • Here's a pretty good walk through site that should explain it @aloneguid http://ryanlanciaux.com/post/real-ultimate-power--dependency-injection-with-ninject.aspx – Bryan Ray Jun 17 '10 at 02:45
  • 4
    That link is no longer valid. Most of the documentation is now at the GitHub Wiki which unfortunately hasn't been completely updated to Ninject 2 yet. http://wiki.github.com/ninject/ninject/ – Martin Owen Aug 21 '10 at 17:22
  • I haven't read it yet, but [Bryan Ray's article](http://ryanlanciaux.com/ryanlanciaux/post/Real-Ultimate-Power-Dependency-Injection-with-Ninject.aspx) moved on him. – patridge Apr 04 '11 at 20:53
  • 1
    New URL for Bryan's post: http://www.ryanlanciaux.com/2008/03/26/real-ultimate-power-dependency-injection-with-ninject/ – Cameron Hotchkies Sep 27 '11 at 19:12
3

Have you look at the ninject-contrib project at Google Code?

Thedric Walker
  • 1,817
  • 15
  • 23
2

You can take a look at Rob's MVC Starter site MVC application (MVC2 and Ninject): http://mvcstarter.codeplex.com/

VinnyG
  • 6,883
  • 7
  • 58
  • 76
1

I would recommend the book Pro ASP.NET MVC 3 Framework. It has some excellent samples and explanations on how to implement Ninject as well as Moq and Unit Testing, in an easy-to-read format that doesn't make you feel like a Dummy.

Michael Glass
  • 472
  • 5
  • 10