Supposing I have a method GetAssemblies, which returns a list of assemblies, and a method called GetConventions, which returns a ConventionBuilder, I might compose my container like this:
CompositionHost container =
new ContainerConfiguration()
.WithAssemblies(
GetAssemblies(),
GetConventions())
.CreateContainer();
But I might also compose it like this:
CompositionHost container =
new ContainerConfiguration()
.WithAssemblies(GetAssemblies())
.WithDefaultConventions(GetConventions())
.CreateContainer();
Question: What is the difference, if any, between these two ways of doing it?
It is the word "default" in WithDefaultConventions that is throwing me. MSDN doesn't shed much light on what this means. If the method was simply called WithConventions, I wouldn't have given it a second thought.
Example methods below.
GetAssemblies:
private static IEnumerable<Assembly> GetAssemblies()
{
return new[]
{
typeof(FileQueue).Assembly,
typeof(LoggerExport).Assembly,
};
}
GetConventions:
private static ConventionBuilder GetConventions()
{
var conventionBuilder = new ConventionBuilder();
conventionBuilder
.ForType<OmsDbContext>()
.Export<OmsDbContext>()
.SelectConstructor(ctorInfos => ctorInfos.First())
.Shared("Boundary.UnitOfWork");
return conventionBuilder;
}