How to register assemblies using Windsor in ASP.NET MVC
- by oz
This is how my project looks:
TestMvc (my web project) has a reference to the DomainModel.Core assembly where my interfaces and business objects reside.
The class that implements the interfaces in DomainModel.Core is in a different assembly called DomainModel.SqlRepository; the reason behind it is that if I just want to create a repository for Oracle I just have to deploy the new dll, change the web.config and be done with it.
When I build the solution, if I look at the \bin folder of my TestMvc project, there is no reference to the DomainModel.SqlRepository, which makes sense because it's not being reference anywhere.
Problem arises when my windsor controller factory tries to resolve that assembly, since it's not on the \bin directory. So is there a way to point windsor to a specific location, without adding a reference to that assembly? My web.config looks like this:
<component id="UserService"
service="TestMvc.DomainModel.Core.Interface, TestMvc.DomainModel.Core"
type="TestMvc.DomainModel.SqlRepository.Class, TestMvc.DomainModel.SqlRepository"
lifestyle="PerWebRequest" />
There's many ways around this, like copying the dll as part of the build, add the reference to the project so it will get copied to the \bin folder or install it on the GAC and add an assembly reference in the web.config. I guess my question is specific to Windsor, to see if I can give the location of my assembly and it will resolve it.