The purpose of the scan. TheCallingAssembly, scan.WithDefaultConventions in StructureMap-MVC3

When you add the StructureMap-MVC3 package to an ASP.NET MVC application, a class is added IoCthat contains a method Initialize(which is 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 code scan.TheCallingAssembly()and scan.WithDefaultConventions()? I do not see a good explanation of these methods in the StructureMap documentation .

When using StructureMap in a project other than MVC, I found that the entire section x.Scancan be deleted without any impact.

+5
source share
1 answer

, , StructureMap, , / .

WithDefaultConventions : " IExample, Example, IExample, Example IExample".

, (IExample), .

+7

All Articles