Mike Nichols - Son of Nun Technology

Binsor Quack...er...Quick Tip

I thought this wasn't working before but tonight I needed to decorate/adapt a component in Windsor using Binsor . When I tried this before, I thought it bombed but I probably just didn't write it correctly..

So...for service IUnitOfWorkFactory I want to create an adapter that will be my default adapter throughout the app. Here's the Binsor bit:

 

#configure unit of work factories

Component("default_unit_of_work", IUnitOfWorkFactory, AppUnitOfWorkFactoryAdapter, inner: @nh_unit_of_work)

Component("nh_unit_of_work", IUnitOfWorkFactory, NHibernateUnitOfWorkFactory)

Note that per Windsor the first registered component is considered the 'default' when not resolved with a key. Boo lets me pass in the component by the key name using the syntax:

parameterName: @keyofregisteredcomponent

I am not sure if the INeedSecondPassRegistration interface  is what enabled this (I don't recall seeing it) but I am happy :)