Note that there are some explanatory texts on larger screens.

plurals
  1. POHow To Implement IoC Containers in MVC Web Application with E.F
    primarykey
    data
    text
    <p>I am trying to wrap my head around IoC containers. As I delve deeper into this design pattern I come across multitudes of abstraction layers, interfaces and concrete classes when before I was simply instantiating a data-context class, using it and then disposing of it.</p> <p>Whilst I am keen to continue forward there are some outstanding issues I don't know how to resolve and would like some clarification and guidance.</p> <ol> <li><p>In a generic web application with 2 projects (mvc web &amp; data layer containing e.f.), if our dependancy resolver expects a repository that implements a specific interface (allowing us to switch repositories at any time in the future), where is this interface defined? I dont see how it can be defined in the mvc web project because then the data access layer will become dependant on it and it cannot reside in the data access layer as then the mvc project depends on the dal and i've missed the whole point of this excercise. So is the answer to define it in both projects and have each project reference its own copy? ..Is that even possible? Or do i need to create a third service layer project and stick one interface declaration in it and have both projects reference this?</p></li> <li><p>Ive seen a number of articles talking about Unity IoC with interfaces such as IProductRepository, IClientRepository and IProductService, IClientService (this is what I was referring to in my opening paragraph). Am I correct in assuming that each of these instances is supposed to reference a table in my database? If so what happens if i have 50 tables? do i need to create 50 repository interfaces and 50 table related interfaces just to decouple everything? And how does using EF with POCO classes impact things? do i need to have each POCO implement its own specified interface?</p></li> </ol> <p>thanks</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload