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

  • Home
  • SEARCH
  • 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 7968875
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T07:08:49+00:00 2026-06-04T07:08:49+00:00

When adding the StructureMap-MVC3 package to an ASP.NET MVC application, an IoC class containing

  • 0

When adding the StructureMap-MVC3 package to an ASP.NET MVC application,
an IoC class containing an Initialize method gets added (that gets called by some code in the App_Start folder) containing the following:

public static class IoC
{
    public static IContainer Initialize()
    {
        ObjectFactory.Initialize(x =>
            {
                x.Scan(scan =>
                    {
                        scan.TheCallingAssembly();
                        scan.WithDefaultConventions();
                    });
                // x.For<IExample>().Use<Example>();
            });
        return ObjectFactory.Container;
    }
}

What is the purpose of the scan.TheCallingAssembly() and scan.WithDefaultConventions() code? I can’t see a good explanation of these methods in the StructureMap documentation.

When using StructureMap in a non-MVC project I’ve found that the whole x.Scan section can be removed without having any impact.

  • 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-04T07:08:49+00:00Added an answer on June 4, 2026 at 7:08 am

    Scanning looks at all the types defined in your Assembly, and applies StructureMap conventions to determine if/how they should be registered in the container.

    WithDefaultConventions means: “if while scanning I find an interface IExample, and there is a type Example that implements IExample, then register Example as the default type for IExample“.

    In many cases, you will be able to ask the container for whatever you are looking for (IExample), and it will return an implementation, without any further configuration.

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

Sidebar

Related Questions

I have an ASP.NET MVC 2 application with a custom StructureMap controller factory to
When adding a new strongly typed view in ASP.NET MVC, these weird classes show
When adding a controller in ASP.Net MVC 3 using Controller with Read/Write actions and
Adding functionality to a class can be done by adding a method or by
Adding a cookie without an expiration in ASP.NET causes the cookie to expire at
Adding member variables to a class certainly boosts the memory footprint of its instances
Adding different plugins, scripts and other jquery the code gets pretty messy. What is
Adding any noncopyable member to a class would prevent the automatic generation of copy
When adding JQuery to hide a class it of course waits for the page
When adding a row to a datatable in vb.net, what is the difference between

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.