public IAppService Start() { var assemblyFileNames = AssemblyFileNames ?? Enumerable.Empty<string>(); var cacheKey = ToolsDirectory.ToLowerInvariant() + ProjectDirectory.ToLowerInvariant() + ConfigurationOptions + string.Join(",", assemblyFileNames); IAppService app; if (AppServiceCache.TryGetValue(cacheKey, out app)) { return app; } var configuration = this.RegisterConfiguration(ToolsDirectory, ProjectDirectory, ConfigurationOptions); if (configuration == null) { return null; } var compositionService = this.RegisterCompositionService(configuration, ProjectDirectory, Assembly.GetCallingAssembly(), assemblyFileNames, CompositionOptions); if (compositionService == null) { return null; } app = new AppService(configuration, compositionService, ToolsDirectory, ProjectDirectory); AppServiceCache[cacheKey] = app; return app; }
public IAppService Start() { IEnumerable<string> assemblyFileNames; if (AssemblyFileNames == null) { assemblyFileNames = Enumerable.Empty<string>(); } else { assemblyFileNames = AssemblyFileNames.Distinct().OrderBy(a => a).ToList(); } var cacheKey = ToolsDirectory.ToLowerInvariant() + ProjectDirectory.ToLowerInvariant() + ConfigurationOptions + string.Join(",", assemblyFileNames); IAppService app; if (AppServiceCache.TryGetValue(cacheKey, out app)) { return app; } var configuration = this.RegisterConfiguration(ToolsDirectory, ProjectDirectory, ConfigurationOptions); if (configuration == null) { return null; } if (!string.IsNullOrEmpty(WebsiteDirectory)) { configuration.Set(Constants.Configuration.WebsiteDirectory, WebsiteDirectory); } if (!string.IsNullOrEmpty(DataFolderDirectory)) { configuration.Set(Constants.Configuration.DataFolderDirectory, DataFolderDirectory); } var compositionService = this.RegisterCompositionService(configuration, ProjectDirectory, Assembly.GetCallingAssembly(), assemblyFileNames, CompositionOptions); if (compositionService == null) { return null; } app = new AppService(configuration, compositionService, ToolsDirectory, ProjectDirectory); AppServiceCache[cacheKey] = app; return app; }