Esempio n. 1
0
        public void Loaded()
        {
            try
            {
                var connectionString = CommandLineArgs.IsProvided(CommandLineArgs.DbConnectionString)
                    ? CommandLineArgs.DbConnectionString
                    : _concreteDbAccess.BuildConnectionString(_config);


                _concreteDbAccess.SetConnectionString(connectionString);

                if (_config.CheckConnectionOnStartup && !_concreteDbAccess.TryConnection(out var e))
                {
                    _logger.Error(e);
                    throw e;
                }
            }
            catch
            {
                Logs.Error("Failed to connect to database");
                throw;
            }
        }