I am new to DI containers and have been doing some reading and I was wondering if you guys could help me out with my first sample project.
I have a MVC5 application separated into n
tier modules. I have my presentation module injecting an IDataAdapter
into a controller via a defaultcontrollerfactory.
This dataadapter
is then passed via constructor injection into a service class that talks to the data access layer via the IDataAdapter.
My question is, where is the IDataAdapter
interface class supposed to be located, obvious the concrete class that implements this interface needs to be in the data access layer. I could leave the interface in the DAL, but then I would need a hard reference between my view and dal, and that does not seem right.
So I made a separate project library to hold my container logic and data adapters, but now I am running into a circular dependency, where my DataAdapter
needs to implement the IDataAdapter
interface, but my unity registration file does not know what the DataAdapter
concrete class is because it can’t reference the DAL.