GetMandatoryConfigValue() публичный Метод

public GetMandatoryConfigValue ( string key ) : string
key string
Результат string
Пример #1
0
        public static void Main(string[] args)
        {
            try
            {
                XmlConfigurator.Configure();

                var cfg = new CommandLineConfiguration { CmdLineArgs = args };
                var commandInstance = new CommandFactory()
                    .CreateCommand(cfg.GetMandatoryConfigValue(CommandKey));

                (commandInstance as IConfigurable)?.Configure(cfg);

                Logger.Info($"Executing command {commandInstance.GetType().Name}...");

                commandInstance.Execute();

                Logger.Info($"Command {commandInstance.GetType().Name} executed.");
            }
            catch (Exception e)
            {
                Logger.Error($"Error executing application: {e.Message}");
                var innerException = e.InnerException;
                while (null != innerException)
                {
                    Logger.Error(innerException.Message);
                    innerException = innerException.InnerException;
                }
                Logger.Error($"Stack trace: {e.StackTrace}");
            }
        }