Is it a good practice to create another project in your solution just to configure the container and for registries? I’m wondering where should I put the container configuration, I currently have all the code in my global asax but it’s getting messy as I add more registries and more advanced injections.
Share
I usually create a Registry class in my web project where I tie everything together with StructureMap. See this: http://structuremap.github.com/structuremap/RegistryDSL.htm
If you have projects in your solution that have a lot of their own configuration, then you may want to give those projects their own registry, but don’t actually register it until application_start in global.asax.
Part of IoC is waiting to tie everything together until you need to. That way it is more configurable. So if you can keep your registry in your website, you’ll have the most flexibility.