Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8660365
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T16:14:11+00:00 2026-06-12T16:14:11+00:00

When using inversion of control in a .Net application, is it acceptable to add

  • 0

When using inversion of control in a .Net application, is it acceptable to add a reference to your data layer in your host application?

Say I have the following individual projects:

  • MyApp.Data (EF classes)
  • MyApp.Business (Service factory / repository)
  • MyApp.Services.MyWCFService (Host)
  • MyApp.Presentation.MVC (Host)
  • MyApp.Business.Tests (Host)

In this situation, I have historically used IoC between MyApp.Business and the host apps – creating interfaces for each service factory / repository, and using DI in the host application. Each application then has the choice to inject its own implementation of my business factories. I’ve never had an issue with this, as my host apps only ever rely on the business layer, and I never have to reference the MyApp.Data assembly (my MyApp.Business generally deals with all calls to the MyApp.Data assembly, and renders the results in to composite business objects).

What I’m trying to achieve with my latest project is to use IoC at every level – i.e. creating interfaces in MyApp.Data, so I can apply mocking and proper unit tests to MyApp.Business. It seems to me that the only way to achieve this is to create an assembly reference to both MyApp.Business and MyApp.Data in the host application, then use DI to inject both the MyApp.Data and MyApp.Business implementations.

This is contrary to everything I’ve been taught with conventional nTier applications, though I understand that it’s DI that’s doing all the work, and the reference is basically for resolution only. Am I right in assuming this is the right way to approach it? Is there a better way?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T16:14:12+00:00Added an answer on June 12, 2026 at 4:14 pm

    In short: Yes, it is acceptable to reference each and any part of your app from the main entry point of your application.

    The concept is called Composition Root.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using C#, asp.net 3.5, SqlServer 2005, Trying to incorporate some inversion of control together
When using dependency injection (DI) and inversion of control (IoC) objects will typically have
It's rare that I hear someone using Inversion of Control (Ioc) principle with .Net.
I am using Castle Windsor's inversion of control in my application. When the application
In my latest ASP.NET MVC 2 application I have been trying to put into
I'm using the asp:Menu control on an ASP.NET 4.0 Webforms page with table-free rendering
I'm building a winforms application using a crystalreportviewer control (version 10.5.3700.0). Application works fine
I have registered a custom MembershipProvider class in my Web.Config file. I'm using Inversion
I am getting into Inversion of Control, specifically using Guice and RoboGuice for Android
I've just started using Inversion of Control containers and I'm having a difficult time

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.