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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T18:00:44+00:00 2026-05-29T18:00:44+00:00

The tutorial by the msdn ( source ) recommends using an IDependencyResolver: IDependencyResolver resolver

  • 0

The tutorial by the msdn (source) recommends using an IDependencyResolver:

 IDependencyResolver resolver = DependencyResolver.Current;
 IDependencyResolver newResolver = new UnityDependencyResolver(container, resolver);
 DependencyResolver.SetResolver(newResolver);

I was under the impression that IDependencyResolver does not properly manage object lifetime because it lacks a release method, and also that is conceptually a service locator anti-pattern (source).

How could I refactor this tutorial to not use IDependencyResolver?

  • 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-29T18:00:46+00:00Added an answer on May 29, 2026 at 6:00 pm

    Use Unity.Mvc3, there is a HierarchicalLifetimeManager that can manage lifetime for objects implementing IDispoable.

    Its not an anti pattern if you resolve only at the composition root here, which basically with MVC is via constructor injection in the controller.

    http://blog.ploeh.dk/2011/07/28/CompositionRoot.aspx

    Note this doesn’t have to be a custom controller factory you create, unity will inject automatically for you. See my code here:
    http://completedevelopment.blogspot.com/2011/12/using-dependency-injection-with-mvc.html

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

Sidebar

Related Questions

I've created my own little c# compiler using the tutorial on MSDN, and it's
I am following a tutorial on http://msdn.microsoft.com/en-us/wp7trainingcourse_usingbingmapslab_topic3#_Toc271039355 . Source code can be found here:
I am completely new to this and am following a tutorial on msdn: http://msdn.microsoft.com/en-us/library/aa645736(v=vs.71).aspx#vcwlkcominteroppart1cclienttutorialanchor2
Any good tutorial with source that will demonstrate how to develop neural network (step
I'm learning WPF and started with this MSDN tutorial. I was just following the
I created a simple AJAX-enabled WCF service based on the MSDN tutorial [ServiceContract(Namespace =
since the new SDK 1.1 is missing the tutorial for ASPProviders, i am currently
I followed the tutorial on msdn about localization, and they implement localized bindings like
I used this MSDN tutorial to create an eye candy look for all the
I am following this tutorial from MSDN. There's something I saw in the code

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.