June 21

Ninject – Dependancy Injection you dont want to fight with.

Posted by Dave
Filed under ASP.Net, Featured | 1 Comment

Ninject   Dependancy Injection you dont want to fight with.

Ninject is a Depencancy Injection Container for asp.net, that provides the developer with the tools to decouple the architecture of an asp.net web application. Decoupling is the process of reducing the dependancies between the components of a project. Especaly when the component is used throughout the other components, like logging, utility and data access classes.

I will be using Ninject in the near future to allow mocking of a data access class in a new project. This will allow me to use a common interface to create two data access classes one of which talks to the application database and the other that uses the Rhino Mocks framework coupled with Ninject to substitute a fake data access class into the application and run the unit tests against it. This ensures that I am testing the code in my application rather than the connection to the database and the data. But what about testing the database I hear you cry. I will be using another set of unit tests to test the real data access class which includes testing the connection and expected results from the database.

Back to Ninject. I have had a look at the syntax and have looked at some of David Hayden’s posts on Ninject which all seam quite simple and easy to understand. I will let you all know how it turns out.

Popularity: 6% [?]

Share this post
  • Twitter
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • Diigo
  • LinkedIn
  • Reddit
  • Technorati

Most Commented Posts

This entry was posted on Sunday, June 21st, 2009 at 10:34 and is filed under ASP.Net, Featured. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

One Response to “Ninject – Dependancy Injection you dont want to fight with.”

  1. Kevin Sparrow on June 26th, 2009 at 14:35

    Hey Dave, be interested to hear howthisgoes, been using Nunit but I could do with a substituted data layer.

Leave a Reply