With dependency injection, there should be a composition root which knows about all bindings.
Also see Mark Seeman's blog entry on Composition Root.
That means it requires a reference to your DAL.
If you really would need to separate your Presentation layer from your DAL then you would need to extract the composition root into a separate assembly (the application) which does not contain the Presentation Layer. The application assembly will define all bindings and compose the object graph. For that it needs to reference all other assemblies (Presentation Layer, DAL,.. what not).
However, ninject and AutoFac offer a slightly different design choice: Modules (see here for a ninject description). Define the DAL bindings in Modules @ DAL assembly, define presentation bindings in modules @ presentation assembly and then reflection to load all modules of all deployed assemblies. For example:
-- presentation.dll
- PresentationModule : NinjectModule
--> defines presentation bindings
-- dal.dll
- DataAccessModule : NinjectModule
--> defines data access bindings
-- app.dll (asp.net mvc application)
- creates kernel
- then searches for all deployed *.dll's,
in those it searches for all implementations of `NinjectModule`
and then loads these. This is done by:
kernel.Load(AppDomain.CurrentDomain.GetAssemblies())
- does not reference dal.dll or presentation.dll!
Please note that I'm not sure whether AppDomain.CurrentDomain.GetAssemblies()
works for an asp.net application. Maybe you'll need some other approach to find all deployed assemblies.
Also note that unless you need to have tiers (also see here) or change layers without rebuilding the entire application, it is not necessary to have separate assemblies for separate layers.
There's also some similar questions with answers:
and you might also want to look at this blog post