Possible Duplicate:
Ioc/DI – Why do I have to reference all layers/assemblies in entry application?
I’ve decided to build a new MVC 3 application using Autofac as the DI container.
Since all my container configuration is done within the MVC project it forces a reference to all layers e.g. Data, which ideally the web project should have no idea about.
Is there a simple way to move this to a separate “fabric” class library? The problem I’m encountering is that I can’t then configure the controllers in the fabric project as it would result in a circular reference between Fabric and MVC projects.
I understand that the reference is only used for configuration but not having the references will ensure a naughty developer doesn’t start referencing the classes directly.
On a related note does anyone have any feelings about abstracting their DI container – or is this just getting carried away! As a rule of thumb I think it’s good practise to wrap third party assemblies but at this level?
Thanks in advance,
Tom.
If you don’t reference those layers, how do you expect the corresponding assemblies end up in your
binfolder at runtime? You shouldn’t be worried for referencing those layers in the MVC application.You should teach your developers good practices.