public static IApplicationLoader FindLoader(string bootstrapperType)
{
if (bootstrapperType.IsNotEmpty())
{
var type = Type.GetType(bootstrapperType);
return BuildApplicationLoader(type);
}
var candidates = FindLoaderTypes();
if (candidates.Count() == 1)
{
return BuildApplicationLoader(candidates.Single());
}
else if (candidates.Any())
{
throw new Exception(
"Found multiple candidates, you may need to specify an explicit selection in the bottle-service.config file. \nCandidates found are " +
candidates.Select(x => x.AssemblyQualifiedName).Join(",\n"));
}
else
{
Console.WriteLine("Found no loaders or application sources");
}
return new DefaultBottleApplication();
}