I'm trying to implement StructureMap into my ASP.Net MVC 3 application. My architecture follows n-tier approach where my UI tier talks with my services tier which in turn talks with my business tier which in turn talks with the repository tier. I have data contracts that represent the data flowing through all tiers.
My UI tier should only know about the services tier. My UI should not know of or care about the business let alone the repository or data tiers. Each tier is it's own assembly and I'm using constructor dependency injection to inject the necessary instances (ie I'm injecting the business object into my service constructor and injecting the repository object into the business constructor).
So, if my tiers are in separate assemblies, and the UI assembly where Structure Map resides does not know about the lower tiers, then how do I configure structure map? I'm reluctant to create references in my UI tier to all "lower" tiers that sit behind the services tier. If I do that, then that potentially opens the door for the UI to talk with the database directly which is bad.
Been there done that. Took idea directly just like You, thinking that avoiding assembly references will resolve everything. I even managed to do what You are trying to with post-build xcopy'ing built dll`s. In reality - that just made it way more confusing than it is supposed to be.
The thing is - references themselves aren't root of evil. It's fine to reference everything from uppermost (UI) assembly. Bad code is what causes trouble.