loads of useful information, examples and tutorials pertaining to web development utilizing asp.net, c#, vb, css, xhtml, javascript, sql, xml, ajax and everything else...

 



Advertise Here
C-Sharpener.com - Programming is Easy!  Learn Asp.Net & C# in just days, Guaranteed!

Setting up Castle Windsor IoC (Inversion of Control) aka Dependency Injection

by naspinski 10/4/2009 10:55:00 AM

it can be a bit confusing getting this thing running

Dependency Injection is the new big thing, and I am late on that bandwagon. But I recently began using Castle Windsor while learning ASP.NET MVC through reading Pro ASP.NET MVC Framework which is a fantastic book.

Anyway, setup can be a little pain to go through, and is no longer exactly as written out by the book, so here is a quick and simple guide:

download/reference

  • Visit the Project Page and look for the MicroKernel/Windsor project, download the latest stable version (it was 2.0.0 while writing this).
  • Copy the dlls to your bin or register them in your GAC.
  • Reference the following libraries:
    • Castle.Core
    • Castle.DynamicProxy2
    • Castle.MicroKernel
    • Castle.Windsor

alter your web.config

Add in the following inside the <configSections$gt;

<section name="castle" type="Castle.Windsor.Configuration.AppDomain. CastleSectionHandler, Castle.Windsor" />


Add this right before your <system.web>

<castle><components></components></castle>


that's it

That's all it takes, your Castle Windsor should now be running.

Currently rated 3.0 by 4 people

  • Currently 3/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags:

asp.net | mvc

Related posts


Comments are closed