public string GetJson(string sectionName) { string result = null; Failover .Execute(() => { XmlNode config; lock (_syncRoot) { config = GetXmlNode(sectionName); } if (config != null) { result = JsonConvert.SerializeXmlNode(config, Formatting.None, true); } }); return(result); }
public string GetXml(string sectionName) { string result = null; Failover .Execute(() => { XmlNode config; lock (_syncRoot) { config = GetXmlNode(sectionName); } if (config != null) { result = config.OuterXml; } }); return(result); }
public T Get <T>() { var result = default(T); Failover .Execute(() => { var sectionName = typeof(T).Name; object config; lock (_syncRoot) { if (!_parsedConfigurationsCache.TryGetValue(sectionName, out config)) { config = ParseConfigData <T>(sectionName); } } result = (T)config; }); return(result); }
public static int Run(string[] args) { var exitCode = 0; var options = new DbManagerOptions(); Failover.Execute(() => { Parser.Default.ParseArguments(args, options); if (!CheckInitOptions(options)) { Logger.Info(options.GetUsage()); return; } if (options.ShowAll) { ShowAll(options); return; } if (options.Backup) { BackupDatabase(options); return; } if (options.RestoreBackup) { RestoreBackupDatabase(options); return; } if (options.Upgrade) { UpdateDatabase(options); return; } if (options.Downgrade) { DowngradeDatabase(options); return; } if (options.Check) { Logger.Info(Check(options)); return; } if (options.Recreate) { DropDataBase(); UpdateDatabase(options); } if (options.DropDatabase) { DropDataBase(); } }, exception => { exitCode = -1; }); if (options.Wait) { Console.ReadKey(); } return(exitCode); }
public void Execute(IJobExecutionContext context) { Failover.Execute(() => typeof(ExecuteSingletonJobEx <TExecution>).ExecuteInMonitor(() => Current <TExecution> .Instance.Execute(context))); }
public void Execute(IJobExecutionContext context) { Failover.Execute(() => typeof(ExecutePerCallJob <TExecution>).ExecuteInMonitor(new TExecution().Execute)); }
public static int[] ParseString2IntArray(this string source) { return (Failover.Execute( () => source.Split(SEPARATORS).Select(_ => _.Trim()).Select(_ => Int32.Parse(_)).ToArray(), exception => new int[0])); }