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.