Bottles.Services.BottleServiceApplication.FindLoader C# (CSharp) Метод

FindLoader() приватный Метод

private FindLoader ( string bootstrapperType ) : IApplicationLoader
bootstrapperType string
Результат IApplicationLoader
        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();
        }

Usage Example

Пример #1
0
 private IApplicationLoader bootstrap()
 {
     return(BottleServiceApplication.FindLoader(_configuration.BootstrapperType));
 }