本文整理汇总了C#中IConfigService.Get方法的典型用法代码示例。如果您正苦于以下问题:C# IConfigService.Get方法的具体用法?C# IConfigService.Get怎么用?C# IConfigService.Get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IConfigService
的用法示例。
在下文中一共展示了IConfigService.Get方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SafeBlockProvider
public SafeBlockProvider(IConfigService configService, ILogger logger)
{
var exceptionHandlePolicies = configService.Get<ExceptionHandlePolicy>("ExceptionHandlePolicy");
this.logger = logger;
this.retryCount = configService.Get<int>("ExceptionPolicy", "RetryCount");
this.exceptionPolicies = new Dictionary<string, ExceptionPolicy>();
this.Load(exceptionHandlePolicies);
}
示例2: Uri
IServiceHost IServiceHostFactory.Create(IConfigService configService, IUtilityProvider utility)
{
var hostConfig = configService.Get<WCFSelfHostConfig>(ConfigGroup, ServiceName);
int length = hostConfig.BaseAddresses.Length;
Uri[] uris = new Uri[length];
for (int init = 0; init < length; init++)
{
uris[init] = new Uri(hostConfig.BaseAddresses[init]);
}
return new WCFSelfHost(Type.GetType(hostConfig.Type), uris);
}
示例3: Create
internal static IPrintService Create(IConfigService configService, ILogger logger)
{
IPrintService printService = null;
PrintServiceConfig printServiceConfig = configService.Get<PrintServiceConfig>("PrintManager", "ServiceConfig", null);
if (null == printServiceConfig)
{
printService = new PrintServiceNull();
logger.LogDebug("PrintService", "Print Service not configured. All request to print will throw exception");
}
else
{
printService = new PrintService(printServiceConfig, logger);
}
return printService;
}
示例4: ThreadProviderFactory
internal ThreadProviderFactory(IConfigService configService)
{
ThreadProvider threadProvider = configService.Get<ThreadProvider>("Threading", "Provider", ThreadProvider.ThreadPool);
switch (threadProvider)
{
case ThreadProvider.ThreadPool:
this.provider = ThreadPoolThreadProvider.Instance;
break;
case ThreadProvider.UserThread:
this.provider = UserThreadProvider.Instance;
break;
default:
case ThreadProvider.None:
throw new ArgumentOutOfRangeException("Threading.Provider", "Invalid Threading Provider configured");
}
}
示例5: Create
public static IInstrumentation Create(IConfigService configService)
{
var instrumentationConfiguration = configService.Get<InstrumentationConfiguration>("Instrumentation", "Instrumentation");
instrumentationConfiguration.Fill();
return new Instrumentation(instrumentationConfiguration.GetCounterCollection(), instrumentationConfiguration.GetDefaultCounter());
}
示例6: Create
public static IDebug Create(IConfigService configService)
{
var traceConfiguration = configService.Get<TraceConfiguration>("Trace", "Trace");
traceConfiguration.Fill();
return new Debug(traceConfiguration.GetTraceCollection(), traceConfiguration.GetDefaultTrace());
}
示例7: Configure
public static void Configure(IConfigService configService, IUtilityProvider _utilityProvider, IResourceService _iResourceSerive)
{
utilityProvider = _utilityProvider;
iResourceService = _iResourceSerive;
/*Call LoadCommandConfig Method to Load all the Command Configuration through ConfigService.*/
IEnumerable<CommandConfig> commands = configService.Get<CommandConfig>("CommandTypeConfig");
IEnumerable<CommandActionConfig> actionConfigList = configService.Get<CommandActionConfig>("CommandActionTypeConfig");
foreach (CommandActionConfig actionConfig in actionConfigList)
{
ControllerCreateParams controllerConfig = new ControllerCreateParams();
controllerConfig.Name = actionConfig.ActionKey;
controllerConfig.AllowAnonymous = actionConfig.AllowAnonymous;
controllerConfig.ExceptionPolicy = actionConfig.ExceptionPolicy;
controllerConfig.TaskId = actionConfig.TaskId;
CommandConfig cmd = commands.Where<CommandConfig>(o => o.CommandKey == actionConfig.CommandConfig).FirstOrDefault();
if (cmd != null)
{
Type commandType = Type.GetType(cmd.CommandUri);
controllerConfig.CommandType = commandType;
if (commandType != null)
{
while (commandType.Name != typeof(ProcessCommand<,>).Name && commandType.Name != typeof(ParameterizedActionCommand<>).Name && commandType.Name != typeof(RequestCommand<>).Name && commandType.Name != typeof(ExecutorCommand).Name)
{
commandType = commandType.BaseType;
}
Type[] param = commandType.GetGenericArguments();
if (commandType.Name == typeof(ProcessCommand<,>).Name)
{
controllerConfig.RequestViewModel = param[0];
controllerConfig.ReponseViewModel = param[1];
controllerConfig.ControllerType = typeof(Processor<,,>).MakeGenericType(
new Type[] { controllerConfig.CommandType, controllerConfig.RequestViewModel, controllerConfig.ReponseViewModel });
}
else if (commandType.Name == typeof(ParameterizedActionCommand<>).Name)
{
controllerConfig.RequestViewModel = param[0];
controllerConfig.ControllerType = typeof(ParamterizedExecutor<,>).MakeGenericType(
new Type[] { controllerConfig.CommandType, controllerConfig.RequestViewModel });
}
else if (commandType.Name == typeof(RequestCommand<>).Name)
{
controllerConfig.ReponseViewModel = param[0];
controllerConfig.ControllerType = typeof(Requestor<,>).MakeGenericType(
new Type[] { controllerConfig.CommandType, controllerConfig.ReponseViewModel });
}
else if (commandType.Name == typeof(ExecutorCommand).Name)
{
controllerConfig.ControllerType = typeof(Executor<>).MakeGenericType(
new Type[] { controllerConfig.CommandType });
}
controllerConfig.DivId = actionConfig.RefreshDiv;
controllerConfig.ViewName = actionConfig.ViewName;
ResultType result;
Enum.TryParse(actionConfig.ResultType, out result);
controllerConfig.ResultBuilder = result;
ControllerBag.Add(controllerConfig.Name, controllerConfig);
}
else
{
utilityProvider.GetLogger().LogFatal("Controller Configurator", 9000);
}
}
else
{
utilityProvider.GetLogger().LogFatal("Controller Configurator", 9001);
}
}
}