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();
});
});
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.
source
share