本文整理汇总了C#中IConfiguration类的典型用法代码示例。如果您正苦于以下问题:C# IConfiguration类的具体用法?C# IConfiguration怎么用?C# IConfiguration使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IConfiguration类属于命名空间,在下文中一共展示了IConfiguration类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Configure
/// <exception cref="System.Exception"></exception>
protected override void Configure(IConfiguration config)
{
IClientConfiguration clientConfiguration = Db4oClientServerLegacyConfigurationBridge
.AsClientConfiguration(config);
clientConfiguration.PrefetchDepth = 3;
clientConfiguration.PrefetchObjectCount = 3;
}
示例2: UnicornConfigurationRolesEventHandler
public UnicornConfigurationRolesEventHandler(IConfiguration configuration)
{
Assert.ArgumentNotNull(configuration, nameof(configuration));
_predicate = configuration.Resolve<IRolePredicate>();
_dataStore = configuration.Resolve<IRoleDataStore>();
}
示例3: Runner
public Runner(IConfiguration configuration, IDependencyRepository repository, ISearchFileManager searchFileManager)
: this()
{
_configuration = configuration;
_repository = repository;
_searchFileManager = searchFileManager;
}
示例4: AllRootPathsExist
/// <summary>
/// Verifies that all root paths defined in the predicate exist in Sitecore
/// In other words, if you were to reserialize this configuration would there be something
/// to serialize at all root locations?
/// </summary>
public static bool AllRootPathsExist(IConfiguration configuration)
{
var predicate = configuration.Resolve<PredicateRootPathResolver>();
var sourceDataStore = configuration.Resolve<ISourceDataStore>();
return predicate.GetRootPaths().All(include => RootPathExists(sourceDataStore, include));
}
示例5: ObtainImplementation
private Type ObtainImplementation(Type type, IConfiguration configuration)
{
var typeNode = configuration.Attributes["type"];
if (String.IsNullOrEmpty(typeNode))
{
if (type.IsInterface)
{
throw new ConverterException("A type attribute must be specified for interfaces");
}
return type;
}
var implType = Context.Composition.PerformConversion<Type>(typeNode);
if (!type.IsAssignableFrom(implType))
{
var message = String.Format("Type {0} is not assignable to {1}",
implType.FullName, type.FullName);
throw new ConverterException(message);
}
return implType;
}
示例6: _configure
/// <exception cref="System.Exception"></exception>
protected virtual void _configure(IConfiguration config)
{
ConfigIndexed(config, typeof (DataA), FieldA);
ConfigIndexed(config, typeof (DataA), FieldB);
ConfigIndexed(config, typeof (DataB), FieldA);
ConfigIndexed(config, typeof (DataB), FieldB);
}
示例7: IMRUJobDefinition
/// <summary>
/// Constructor
/// </summary>
/// <param name="mapFunctionConfiguration">Map function configuration</param>
/// <param name="mapInputCodecConfiguration">Map input codec configuration</param>
/// <param name="updateFunctionCodecsConfiguration">codec configuration for update
/// function. It is union of TMapInput, TMapOutput and TResult configuration</param>
/// <param name="reduceFunctionConfiguration">Reduce function configuration</param>
/// <param name="updateFunctionConfiguration">Update function configuration</param>
/// <param name="mapOutputPipelineDataConverterConfiguration">Configuration of
/// PipelineDataConverter for TMapOutput</param>
/// <param name="mapInputPipelineDataConverterConfiguration">Configuration of
/// PipelineDataConverter for TMapInput</param>
/// <param name="partitionedDatasetConfiguration">Configuration of partitioned
/// dataset</param>
/// <param name="perMapConfigGeneratorConfig">Per mapper configuration</param>
/// <param name="numberOfMappers">Number of mappers</param>
/// <param name="memoryPerMapper">Per Mapper memory.</param>
/// <param name="jobName">Job name</param>
internal IMRUJobDefinition(
IConfiguration mapFunctionConfiguration,
IConfiguration mapInputCodecConfiguration,
IConfiguration updateFunctionCodecsConfiguration,
IConfiguration reduceFunctionConfiguration,
IConfiguration updateFunctionConfiguration,
IConfiguration mapOutputPipelineDataConverterConfiguration,
IConfiguration mapInputPipelineDataConverterConfiguration,
IConfiguration partitionedDatasetConfiguration,
ISet<IConfiguration> perMapConfigGeneratorConfig,
int numberOfMappers,
int memoryPerMapper,
int updateTaskMemory,
string jobName)
{
_mapFunctionConfiguration = mapFunctionConfiguration;
_mapInputCodecConfiguration = mapInputCodecConfiguration;
_updateFunctionCodecsConfiguration = updateFunctionCodecsConfiguration;
_reduceFunctionConfiguration = reduceFunctionConfiguration;
_updateFunctionConfiguration = updateFunctionConfiguration;
_mapOutputPipelineDataConverterConfiguration = mapOutputPipelineDataConverterConfiguration;
_mapInputPipelineDataConverterConfiguration = mapInputPipelineDataConverterConfiguration;
_partitionedDatasetConfiguration = partitionedDatasetConfiguration;
_numberOfMappers = numberOfMappers;
_jobName = jobName;
_memoryPerMapper = memoryPerMapper;
_updateTaskMemory = updateTaskMemory;
_perMapConfigGeneratorConfig = perMapConfigGeneratorConfig;
}
示例8: ConfigurationLoginProviderCredentials
public ConfigurationLoginProviderCredentials(IConfiguration config)
{
Key = config["Key"];
Secret = config["Secret"];
Use = !string.IsNullOrWhiteSpace(Key) && !string.IsNullOrWhiteSpace(Secret);
}
示例9: SetUp
public void SetUp()
{
_project = new Project(Path.GetFullPath("someProject.csproj"), new ProjectDocument(ProjectType.CSharp));
_project.Value.SetOutputPath("");
_project.Value.SetAssemblyName("someAssembly.dll");
_bus = MockRepository.GenerateMock<IMessageBus>();
_listGenerator = MockRepository.GenerateMock<IGenerateBuildList>();
_configuration = MockRepository.GenerateMock<IConfiguration>();
_buildRunner = MockRepository.GenerateMock<IBuildRunner>();
_testRunner = MockRepository.GenerateMock<ITestRunner>();
_testAssemblyValidator = MockRepository.GenerateMock<IDetermineIfAssemblyShouldBeTested>();
_optimizer = MockRepository.GenerateMock<IOptimizeBuildConfiguration>();
_runInfo = new RunInfo(_project);
_runInfo.ShouldBuild();
_runInfo.SetAssembly(_project.Value.AssemblyName);
_optimizer.Stub(o => o.AssembleBuildConfiguration(new string[] {})).IgnoreArguments().Return(new RunInfo[] { _runInfo });
_preProcessor = MockRepository.GenerateMock<IPreProcessTestruns>();
_preProcessor.Stub(x => x.PreProcess(null)).IgnoreArguments().Return(new RunInfo[] { _runInfo });
var preProcessors = new IPreProcessTestruns[] { _preProcessor };
var buildPreProcessor = MockRepository.GenerateMock<IPreProcessBuildruns>();
buildPreProcessor.Stub(x => x.PreProcess(null)).IgnoreArguments().Return(new RunInfo[] { _runInfo });
var buildPreProcessors = new IPreProcessBuildruns[] { buildPreProcessor };
_removedTestLocator = MockRepository.GenerateMock<ILocateRemovedTests>();
_consumer = new ProjectChangeConsumer(_bus, _listGenerator, _configuration, _buildRunner, new ITestRunner[] { _testRunner }, _testAssemblyValidator, _optimizer, preProcessors, _removedTestLocator, buildPreProcessors);
}
示例10: AddDocumentDbRepositories
public static void AddDocumentDbRepositories(this IServiceCollection services, IConfiguration configuration)
{
if (Current == null)
{
Current = new DocDb(services, configuration);
}
}
示例11: AddQueryAliases
private static void AddQueryAliases(IConfiguration config)
{
config.AddAlias(new TypeAlias("com.db4o.query.Evaluation", FullyQualifiedName(typeof (IEvaluation))));
config.AddAlias(new TypeAlias("com.db4o.query.Candidate", FullyQualifiedName(typeof (ICandidate))));
config.AddAlias(new WildcardAlias("com.db4o.internal.query.processor.*",
"Db4objects.Db4o.Internal.Query.Processor.*, Db4objects.Db4o"));
}
示例12: BindDictionary
private static void BindDictionary(object dictionary, Type dictionaryType, IConfiguration config)
{
var typeInfo = dictionaryType.GetTypeInfo();
// IDictionary<K,V> is guaranteed to have exactly two parameters
var keyType = typeInfo.GenericTypeArguments[0];
var valueType = typeInfo.GenericTypeArguments[1];
if (keyType != typeof(string))
{
// We only support string keys
return;
}
var addMethod = typeInfo.GetDeclaredMethod("Add");
foreach (var child in config.GetChildren())
{
var item = BindInstance(
type: valueType,
instance: null,
config: child);
if (item != null)
{
var key = child.Key;
var section = config as IConfigurationSection;
if (section != null)
{
// Remove the parent key and : delimiter to get the configurationSection's key
key = key.Substring(section.Key.Length + 1);
}
addMethod.Invoke(dictionary, new[] { key, item });
}
}
}
示例13: BindCollection
private static void BindCollection(object collection, Type collectionType, IConfiguration config)
{
var typeInfo = collectionType.GetTypeInfo();
// ICollection<T> is guaranteed to have exacly one parameter
var itemType = typeInfo.GenericTypeArguments[0];
var addMethod = typeInfo.GetDeclaredMethod("Add");
foreach (var section in config.GetChildren())
{
try
{
var item = BindInstance(
type: itemType,
instance: null,
config: section);
if (item != null)
{
addMethod.Invoke(collection, new[] { item });
}
}
catch
{
}
}
}
示例14: Create
public static IWebDriver Create(TestTarget browser, out IConfiguration defaultConfig)
{
var config = GetDriverConfig(browser);
config.CurrentBrowser = browser;
defaultConfig = config;
return Create(config);
}
示例15: ConfigureAutoMapper
private void ConfigureAutoMapper(IConfiguration cfg)
{
//AutoMapper Help
//https://github.com/AutoMapper/AutoMapper/wiki
//http://www.rqna.net/qna/yxzrz-automapper-bidirectional-mapping-with-reversemap-and-formember.html
//基类执行程序集搜索、Mappter 初始化。
//scan all assemblies finding Automapper Profile
var profiles = DotEnvironment.GetAppPlugins()
.SelectMany(p => p.Assembly.GetTypes())
.Where(t => t.BaseType == typeof(AutoMapper.Profile))
.Distinct().ToList();
foreach (var item in profiles)
{
cfg.AddProfile(Activator.CreateInstance(item) as AutoMapper.Profile);
}
var maps = Mapper.GetAllTypeMaps();
foreach (var map in maps)
{
}
Dot.Utility.Log.LogFactory.PlatformLog.Debug("Domain Dto 映射完成");
}