public SingletonToolsFactory( IToolsService toolsService, IFrameworkPrecedenceService frameworkPrecendenceService, IFrameworkList frameworkList) { _version = toolsService.Version; _toolsService = toolsService; _frameworkPrecendenceService = frameworkPrecendenceService; _frameworkList = frameworkList; }
public ToolsFactory(IPackageLoader packageLoader, IAlignedVersionsDownloader downloader, IFrameworkList frameworkList, ILogger <ToolsFactory> log) { _packageLoader = packageLoader; _downloader = downloader; _frameworkList = frameworkList; _nuGetLog = new MicrosoftLogger(log); _releases = new Lazy <Task <Dictionary <NuGetVersion, NuGetRelease> > >(async() => { using (var sourceCacheContext = new SourceCacheContext()) { var versions2x = await _downloader.GetDownloadedVersionsAsync( PackageIds2x, sourceCacheContext, _nuGetLog, CancellationToken.None); var pairs2x = versions2x .Select(x => new KeyValuePair <NuGetVersion, NuGetRelease>(x, NuGetRelease.Version2x)); var versions3x = await _downloader.GetDownloadedVersionsAsync( PackageIds3x, sourceCacheContext, _nuGetLog, CancellationToken.None); var pairs3x = versions3x .Select(x => new KeyValuePair <NuGetVersion, NuGetRelease>(x, NuGetRelease.Version3x)); return(pairs2x .Concat(pairs3x) .ToDictionary(x => x.Key, x => x.Value)); } }); _versions = new Lazy <Task <Dictionary <string, NuGetVersion> > >(async() => { var releases = await _releases.Value; return(releases .ToDictionary( x => x.Key.ToNormalizedString(), x => x.Key, StringComparer.OrdinalIgnoreCase)); }); _versionStrings = new Lazy <Task <List <string> > >(async() => { var versions = await _versions.Value; return(versions .OrderByDescending(x => x.Value) .Select(x => x.Key) .ToList()); }); }
public FrameworkPrecedenceService(string version, IFrameworkList frameworkList, IFrameworkLogic <TFramework> logic) { Version = version; _frameworkList = frameworkList; _logic = logic; }