private JobHostConfiguration Initialize() { JobHostConfiguration hostConfig = new Microsoft.Azure.WebJobs.JobHostConfiguration(); foreach (var path in _map.Values) { // We don't want to load and reflect over every dll. // By convention, restrict to based on filenames. var filename = Path.GetFileName(path); if (!filename.ToLowerInvariant().Contains("extension")) { continue; } if (path.Contains(@"\ref\")) // Skip reference assemblies. { continue; } Assembly assembly; try { // See GetNugetPackagesPath() for details // Script runtime is already setup with assembly resolution hooks, so use LoadFrom assembly = Assembly.LoadFrom(path); string asmName = new AssemblyName(assembly.FullName).Name; _mapRef[asmName] = assembly; LoadExtensions(hostConfig, assembly, path); } catch (Exception e) { // Could be a reference assembly. continue; } } return(hostConfig); }
/// <summary> /// Initializes a new instance of the <see cref="JobHost"/> class using the configuration provided. /// </summary> /// <param name="configuration">The job host configuration.</param> public JobHost(JobHostConfiguration configuration) : this((IServiceProvider)ThrowIfNull(configuration)) { }