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 891379
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T13:52:54+00:00 2026-05-15T13:52:54+00:00

I have implemented Unity within my Asp.Net MVC2 project. I am currently registering my

  • 0

I have implemented Unity within my Asp.Net MVC2 project. I am currently registering my BLL types on Application Start.

Then I created a class called UnityControllerFactory that is in charge of resolving my dependencies within my controllers. I am simply using Property injection to accomplish this by using the dependency attribute.

My next thought is to remove my dependencies that are contained within in my BLL classes that are tied to the concrete implementation of the DAL layer classes. I would also like to be able to do this via Property injection instead of constructor injection since I am referencing multiple classes within my Bll class methods.

I was hoping for some guidance on any solutions out there that tackle this exact problem or is this completely overkill?

  • 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-05-15T13:52:55+00:00Added an answer on May 15, 2026 at 1:52 pm

    If your BLL classes are being created by Unity, then it is not going to be a problem, the container will just provide the dependencies required by the BLL classes when they are created. If they are not, then you are going to run into an issue, simply because generally speaking, the object that creates your BLL class should also be providing it’s dependencies.

    I would like to caution you on the use of Property based injection, though. The general rule of thumb in the Dependency Injection world is that required dependencies should be injected via the constructor, while optional dependencies should be injected via properties. If your class requires another class in order to do it’s work, there should not be any way to create an instance of the class without also having its required dependencies as well.

    You mentioned using Property injection because of the number of dependencies in your BLL classes. While I understand this, I think it is still vital to follow the required = constructor rule. If you end up with a constructor that has too many dependencies, then this is a code smell that is pointing to a problem somewhere in your design. It could be that the class is taking on too many responsibilities (this usually is the case if you find that some methods require one group of dependencies, while another group require a different set). It could also be that the work being done with the dependencies is too granular, and could be wrapped in another object that could coordinate the work of the dependent classes.

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

Sidebar

Related Questions

I'm currently writing a project in ASP.NET MVC. I have a web project and
I have implemented the Unity DI in a project of mine, but I have,
I have an ASP MVC 3 application and in my Model I have implemented
I have an ASP.NET 3.5 SP1 Webforms Application. I use the MVP pattern (supervising
I have a .NET 3.5 web application for which I have implemented a class
I have implemented a table view with multiple threads. Currently when a user taps
We currently have quite a few classes in a project, and each of those
I have an application all done in WPF, using MvvM/Prism/Unity and Remote as datasource.
I have setup unity in my project and it is working for objects that
I have implemented a Database in my project and following several tutorials, have been

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.