using System; using DDTek.Oracle; using NLog; namespace DataModel.Process { /// /// CMS interface /// public partial class CMS { /// /// Query repository name /// private const string RepositoryName = "CMS"; /// /// Query repository instance /// private static readonly QueryRepository queries = new QueryRepository(RepositoryName, Config.CMSQueryRepo); /// /// Shared logger instance /// private static readonly Logger logger = LogManager.GetCurrentClassLogger(); /// /// Gets an open connection to the CMS DB /// /// Opened connection to the CMS DB private static OracleConnection GetConnection() { OracleConnection connection; try { //Create the connection to the database and open it connection = new OracleConnection(Config.CMSCS); connection.Open(); } catch (Exception error) { //Log error and forward logger.Error("GetConnection: failed to open connection to CMS: {0}.", error.Message); throw new Exception("CMS: failed to open connection to CMS database.", error); } return connection; } } }