本文整理汇总了C#中IConfiguration.Value方法的典型用法代码示例。如果您正苦于以下问题:C# IConfiguration.Value方法的具体用法?C# IConfiguration.Value怎么用?C# IConfiguration.Value使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IConfiguration
的用法示例。
在下文中一共展示了IConfiguration.Value方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FileWatcherBasedPackageUploader
/// <summary>
/// Initializes a new instance of the <see cref="FileWatcherBasedPackageUploader"/> class.
/// </summary>
/// <param name="packageQueue">The object that queues packages that need to be processed.</param>
/// <param name="configuration">The configuration.</param>
/// <param name="diagnostics">The object providing the diagnostics methods for the application.</param>
internal FileWatcherBasedPackageUploader(
IQueueSymbolPackages packageQueue,
IConfiguration configuration,
SystemDiagnostics diagnostics)
{
{
Lokad.Enforce.Argument(() => packageQueue);
Lokad.Enforce.Argument(() => configuration);
Lokad.Enforce.Argument(() => diagnostics);
Lokad.Enforce.With<ArgumentException>(
configuration.HasValueFor(CoreConfigurationKeys.s_UploadPath),
Resources.Exceptions_Messages_MissingConfigurationValue_WithKey,
CoreConfigurationKeys.s_UploadPath);
}
m_Queue = packageQueue;
m_Diagnostics = diagnostics;
var uploadPath = configuration.Value<string>(CoreConfigurationKeys.s_UploadPath);
m_Watcher = new FileSystemWatcher
{
Path = uploadPath,
Filter = "*.symbols.nupkg",
EnableRaisingEvents = false,
NotifyFilter = NotifyFilters.FileName | NotifyFilters.CreationTime,
};
m_Watcher.Created += HandleFileCreated;
}
示例2: StoragePathForTestFiles
/// <summary>
/// Returns the full path to the file that contains all the input file data for a given test.
/// </summary>
/// <param name="test">The ID of the test.</param>
/// <param name="configuration">The object that stores the configuration for the current application.</param>
/// <param name="fileSystem">The object that provides access to the file system.</param>
/// <returns>The full path to the package file that contains all the input file data for the given test.</returns>
public static string StoragePathForTestFiles(int test, IConfiguration configuration, IFileSystem fileSystem)
{
var testFile = fileSystem.Path.Combine(
configuration.Value<string>(MasterServiceConfigurationKeys.TestDataDirectory),
string.Format(
CultureInfo.InvariantCulture,
"{0}.zip",
test));
return testFile;
}
示例3: StoragePathForReportFiles
/// <summary>
/// Returns the full path to the directory in which all the test report files are placed.
/// </summary>
/// <param name="test">The ID of the test.</param>
/// <param name="configuration">The object that stores the configuration for the current application.</param>
/// <param name="fileSystem">The object that provides access to the file system.</param>
/// <returns>The full path to the package file that contains all the input file data for the given test.</returns>
public static string StoragePathForReportFiles(int test, IConfiguration configuration, IFileSystem fileSystem)
{
var reportFileDirectory =
fileSystem.Path.Combine(
fileSystem.Path.Combine(
configuration.Value<string>(MasterServiceConfigurationKeys.TestReportFilesDirectory),
"reportfiles"),
string.Format(
CultureInfo.InvariantCulture,
"{0}",
test));
return reportFileDirectory;
}
示例4: TestCycle
/// <summary>
/// Initializes a new instance of the <see cref="TestCycle"/> class.
/// </summary>
/// <param name="configuration">The object that provides access to the configuration options for the application.</param>
/// <param name="testController">The object that handles test execution.</param>
/// <param name="executingTests">The object that stores information about the test that are currently being executed.</param>
/// <param name="diagnostics">The object that provides the diagnostics methods for the application.</param>
/// <exception cref="ArgumentNullException">
/// Thrown if <paramref name="configuration"/> is <see langword="null" />.
/// </exception>
/// <exception cref="ArgumentNullException">
/// Thrown if <paramref name="testController"/> is <see langword="null" />.
/// </exception>
/// <exception cref="ArgumentNullException">
/// Thrown if <paramref name="executingTests"/> is <see langword="null" />.
/// </exception>
/// <exception cref="ArgumentNullException">
/// Thrown if <paramref name="diagnostics"/> is <see langword="null" />.
/// </exception>
public TestCycle(
IConfiguration configuration,
IControlTests testController,
IStoreActiveTests executingTests,
SystemDiagnostics diagnostics)
{
{
Lokad.Enforce.Argument(() => configuration);
Lokad.Enforce.Argument(() => testController);
Lokad.Enforce.Argument(() => executingTests);
Lokad.Enforce.Argument(() => diagnostics);
}
m_TestController = testController;
m_Diagnostics = diagnostics;
m_ExecutingTests = executingTests;
m_CycleTimeInMilliSeconds = configuration.HasValueFor(MasterServiceConfigurationKeys.KeepAliveCycleTimeInMilliSeconds)
? configuration.Value<int>(MasterServiceConfigurationKeys.KeepAliveCycleTimeInMilliSeconds)
: GlobalConstants.DefaultKeepAliveCycleTimeInMilliseconds;
m_MaximumNumberOfCycleFailures = configuration.HasValueFor(MasterServiceConfigurationKeys.MaximumNumberOfCycleFailures)
? configuration.Value<int>(MasterServiceConfigurationKeys.MaximumNumberOfCycleFailures)
: GlobalConstants.DefaultMaximumNumberOfCycleFailures;
m_Timer.AutoReset = true;
m_Timer.Interval = m_CycleTimeInMilliSeconds;
m_Timer.Elapsed += TimerElapsed;
}
示例5: DetermineUsableEndpoints
private static IEnumerable<Tuple<EndpointId, IDatasetActivationCommands>> DetermineUsableEndpoints(
IEnumerable<Tuple<EndpointId, IDatasetActivationCommands>> availableEndpoints,
IConfiguration configuration)
{
IEnumerable<Tuple<EndpointId, IDatasetActivationCommands>> usableNodes = availableEndpoints;
var key = ActivationConfigurationKeys.OffLimitsEndpoints;
if (configuration.HasValueFor(key))
{
var offlimitEndpoints = configuration.Value<IDictionary<string, object>>(key);
var nonUsableNodes = from node in availableEndpoints
from string machine in offlimitEndpoints.Values
where node.Item1.IsOnMachine(machine)
select node.Item1;
usableNodes = from node in availableEndpoints
where (!nonUsableNodes.Contains(node.Item1))
select node;
}
return usableNodes;
}
示例6: SymbolIndexer
/// <summary>
/// Initializes a new instance of the <see cref="SymbolIndexer"/> class.
/// </summary>
/// <param name="packageQueue">The object that queues packages that need to be processed.</param>
/// <param name="configuration">The configuration.</param>
/// <param name="diagnostics">The object that provides the diagnostics methods for the application.</param>
public SymbolIndexer(
IQueueSymbolPackages packageQueue,
IConfiguration configuration,
SystemDiagnostics diagnostics)
{
{
Lokad.Enforce.Argument(() => packageQueue);
Lokad.Enforce.Argument(() => configuration);
Lokad.Enforce.Argument(() => diagnostics);
Lokad.Enforce.With<ArgumentException>(
configuration.HasValueFor(CoreConfigurationKeys.s_SourceIndexUncPath),
Resources.Exceptions_Messages_MissingConfigurationValue_WithKey,
CoreConfigurationKeys.s_SourceIndexUncPath);
Lokad.Enforce.With<ArgumentException>(
configuration.HasValueFor(CoreConfigurationKeys.s_SymbolsIndexUncPath),
Resources.Exceptions_Messages_MissingConfigurationValue_WithKey,
CoreConfigurationKeys.s_SymbolsIndexUncPath);
Lokad.Enforce.With<ArgumentException>(
configuration.HasValueFor(CoreConfigurationKeys.s_ProcessedPackagesPath),
Resources.Exceptions_Messages_MissingConfigurationValue_WithKey,
CoreConfigurationKeys.s_ProcessedPackagesPath);
}
m_Diagnostics = diagnostics;
m_Queue = packageQueue;
m_Queue.OnEnqueue += HandleOnEnqueue;
var debuggingToolsDirectory = configuration.HasValueFor(CoreConfigurationKeys.s_DebuggingToolsDirectory)
? configuration.Value<string>(CoreConfigurationKeys.s_DebuggingToolsDirectory)
: DefaultSymbolServerToolsDirectory();
m_SymStorePath = Path.Combine(debuggingToolsDirectory, "symstore.exe");
m_SrcToolPath = Path.Combine(debuggingToolsDirectory, "srcsrv", "srctool.exe");
m_PdbStrPath = Path.Combine(debuggingToolsDirectory, "srcsrv", "pdbstr.exe");
m_SourceUncPath = configuration.Value<string>(CoreConfigurationKeys.s_SourceIndexUncPath);
m_SymbolsUncPath = configuration.Value<string>(CoreConfigurationKeys.s_SymbolsIndexUncPath);
m_ProcessedPackagesPath = configuration.Value<string>(CoreConfigurationKeys.s_ProcessedPackagesPath);
}