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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T10:51:21+00:00 2026-05-29T10:51:21+00:00

We use Unity as our IOC Container. Our program is written so far in

  • 0

We use Unity as our IOC Container.

Our program is written so far in a way that we resolve an interface just before we need to use it.

This however results in the interface being resolved inside a loop. Which could result in the interface being resolved 100,000 times in one run.

Question is: Would moving the resolve outside the loop have a significant difference or is this just micro optimisation?

Our progrm takes over a day to run. So for those who will answer “test it yourself”, it is actually faster to ask the question here 🙂

  • 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-29T10:51:21+00:00Added an answer on May 29, 2026 at 10:51 am

    It depends on how you registered the interface I would say. With which LifetimeManager did you register it?
    Does your program always need a new instance? Or can it be the same instance over and over?

    If you need the same instance (Singleton), use the ContainerControlledLifetimeManager:

    Container.RegisterType<Interface, Implementation>(new ContainerControlledLifetimeManager());
    

    If you don’t care about which instance you get (new or old, maintained by GC), you can use ExternallyControlledLifeTimeManager:

    Container.RegisterType<Interface, Implementation>(new ExternallyControlledLifeTimeManager());
    

    You can also create your own implementation of a LifetimeManager to better fit your needs.

    Take a look at this article about LifetimeManagers

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

Sidebar

Related Questions

Since starting at a new company I've noticed that they use unity cpp files
I have written an application that unit tests our hardware via a internet browser.
We use Visual Studio 2010 Ultimate with tests written in MSTest. Both our unit
I'm looking at converting some of our complex creation code to use an IoC
We have all of our unit tests written so that they create and populate
I'm using IntelliJ-Idea to write Java daemons. We use JUnit to unit test our
Within our unit tests we use plain ADO.NET (DataTable, DataAdapter) for preparing the database
I need to use the ReSharper Unit Test Runner to run my MSTest Unit
We have quite a few validation methods that need to access repositories / database
We use use junit for unit testing our java code. Today we use cobertura

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.