I have implemented IOC Castle Container in my current project, which is great experience. As I mentioned before, I have used Castle Active Record in my recently project. AR, with NHibernate under its cover, is definitely improving my productivity. I helps me concentrate on core business logic without worrying about data access details. But there is one thing always bugs me is that I have to declare transaction in data access layers, since I want to maintance a clean business layer without considering any real implementation of data access layers. Any data access logic should be transparent, which means I can replace any other data access implementation without problems. for example, I can switch my nHibernate implementation with Microsoft Enterprise Library or IBatis. In my old design, I heavily utilized data access layers to manage data transactions, so that it becomes bigger and bigger with some business intelligence input which should not be there.
Furtunately, Castle Container is a very open IOC implementation. It allows different components easily to “plug and play” with same interface implemented. With their sample and the help of user forum, I make the container in place in couple hours. Then I implemente Castle transaction manager, remove the transaction from my data access layer, move the real business logic back to business tier. Now my code is much better with clear responsiblity in each layer. My next step is to modify my Active Record as a “Facility” for the container, then i can create a “Enterprise Library” as another “Facility”. Some developers in my group always argue about performance impace with “stored procedure” and without it. I just don’t believe “stored procedure” is a critical issue. So I like to benchmark it side-by-side. I am a real ORM guy. You will see how nice the application architecture is when implementing ORM properly. But unfortunately, most of the Microsoft developers still don’t notice that. “Stored procedure” is a immutable rule. Pretty sad.
Anyway, there have two real time applications implemented with Castle Container I can recommend to you to look at.
1. Cuyahoga, a CRM application using nHibernate with nice Domian/Repository pattern implemented.
2. NPetShop2, a sample application come with IBatics. It not only demostrates the usage of IBastics but also integrates with a true .NET MVC framework which is one of the Castle project as well.