本文整理汇总了C#中IPackageRepositoryFactory.CreateRepository方法的典型用法代码示例。如果您正苦于以下问题:C# IPackageRepositoryFactory.CreateRepository方法的具体用法?C# IPackageRepositoryFactory.CreateRepository怎么用?C# IPackageRepositoryFactory.CreateRepository使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IPackageRepositoryFactory
的用法示例。
在下文中一共展示了IPackageRepositoryFactory.CreateRepository方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetAggregate
public static IPackageRepository GetAggregate(this IPackageSourceProvider provider, IPackageRepositoryFactory factory, bool ignoreFailingRepositories, IEnumerable<string> feeds)
{
Func<string, IPackageRepository> createRepository = factory.CreateRepository;
if (ignoreFailingRepositories)
{
createRepository = (source) =>
{
try
{
return factory.CreateRepository(source);
}
catch (InvalidOperationException)
{
return null;
}
};
}
var repositories = (from item in feeds
let repository = createRepository(provider.ResolveSource(item))
where repository != null
select repository).ToArray();
return new AggregateRepository(repositories) { IgnoreFailingRepositories = ignoreFailingRepositories };
}
示例2: PackageDownloadingService
public PackageDownloadingService(IAgentSettingsManager agentSettingsManager,
IRetrievePackageQuery allPackagesQuery,
ILocalPackageCache agentCache,
IAgentConfigurationManager agentConfigurationManager,
ILogger logger,
IHubCommunicator hubCommunicator,
IInstalledPackageArchive installCache,
IPackageRepositoryFactory packageRepositoryFactory,
IPackagesList allPackagesList,
ICurrentlyDownloadingList currentlyDownloadingList,
CompletedInstallationTaskList installationResults,
IAgentWatchList watchList,
IInstallationManager installationManager,INotificationService notificationService)
{
_settingsManager = agentSettingsManager;
AllPackagesQuery = allPackagesQuery;
AgentCache = agentCache;
_agentConfigurationManager = agentConfigurationManager;
_logger = logger;
_hubCommunicator = hubCommunicator;
_installCache = installCache;
_packageRepository = packageRepositoryFactory.CreateRepository(agentSettingsManager.Settings.NuGetRepository);
_allPackagesList = allPackagesList;
_currentlyDownloadingList = currentlyDownloadingList;
_installationResults = installationResults;
_watchList = watchList;
_installationManager = installationManager;
_notificationService = notificationService;
TimedTask = new TimedSingleExecutionTask(agentSettingsManager.Settings.PackageSyncIntervalMs, FetchPackages,
_logger);
}
示例3: CreateRepository
private static IPackageRepository CreateRepository(IPackageRepositoryFactory repositoryFactory, PackageSource packageSource)
{
IPackageRepository packageRepository = repositoryFactory.CreateRepository(packageSource);
var httpClientEvents = packageRepository as IHttpClientEvents;
if (httpClientEvents != null) {
httpClientEvents.SendingRequest += (sender, args) => {
string userAgent = HttpUtility.CreateUserAgentString(UserAgentClient);
HttpUtility.SetUserAgent(args.Request, userAgent);
};
}
return packageRepository;
}
示例4: PackageRepositoryBrowser
public PackageRepositoryBrowser(ISourceRepositoryProvider sourceRepositoryProvider, IPackageRepositoryFactory packageRepositoryFactory)
{
if (sourceRepositoryProvider == null)
{
throw new ArgumentNullException("sourceRepositoryProvider");
}
if (packageRepositoryFactory == null)
{
throw new ArgumentNullException("packageRepositoryFactory");
}
this.repositoryConfigurations = sourceRepositoryProvider.GetRepositoryConfigurations().ToArray();
this.repositories = this.repositoryConfigurations.Select(r => packageRepositoryFactory.CreateRepository(r.Url.ToString())).ToArray();
}
示例5: LazyRepository
public LazyRepository(IPackageRepositoryFactory factory, PackageSource source)
{
_repository = new Lazy<IPackageRepository>(() => factory.CreateRepository(source.Source));
}
示例6: RetrieveNuGetPackageQuery
public RetrieveNuGetPackageQuery(IPackageRepositoryFactory packageRepositoryFactory, FeedLocation feedLocation, ILogger logger)
{
_packageRepositoryFactory = packageRepositoryFactory;
_logger = logger;
_packageRepository = _packageRepositoryFactory.CreateRepository(feedLocation.Source);
}