StructureMap DI on Model Assembly

Posted by Dan dot net on Stack Overflow See other posts from Stack Overflow or by Dan dot net
Published on 2009-10-22T19:08:51Z Indexed on 2010/06/12 11:02 UTC
Read the original article Hit count: 133

I’m new to Dependency Injection and had a question/need guidance.

I had an application that used the repository pattern for data access. I used StructureMap to get the correct repository and all worked well.

I have since broken out my model (including the repository logic) into its own assembly and added a service layer. In the interest of DI the service layer class takes an IRepository in its constructor. This seems wrong to me as now all consumers of my model need to know about the repository (at least configure their DI to know which one to use). I feel like that is getting into the guts of the model.

What sounds wrong with this?

© Stack Overflow or respective owner

Related posts about c#

Related posts about dependency-injection