26ff8d9b4f
Set up repository with legacy .NET Framework 4.8 source (OLD/), new .NET 10 Blazor solution (NEW/), OpenSpec specifications, documentation, and project configuration.
52 lines
1.5 KiB
C#
Executable File
52 lines
1.5 KiB
C#
Executable File
using System;
|
|
using DDTek.Oracle;
|
|
using NLog;
|
|
|
|
namespace DataModel.Process
|
|
{
|
|
/// <summary>
|
|
/// CMS interface
|
|
/// </summary>
|
|
public partial class CMS
|
|
{
|
|
/// <summary>
|
|
/// Query repository name
|
|
/// </summary>
|
|
private const string RepositoryName = "CMS";
|
|
|
|
/// <summary>
|
|
/// Query repository instance
|
|
/// </summary>
|
|
private static readonly QueryRepository queries = new QueryRepository(RepositoryName, Config.CMSQueryRepo);
|
|
|
|
/// <summary>
|
|
/// Shared logger instance
|
|
/// </summary>
|
|
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
|
|
|
|
/// <summary>
|
|
/// Gets an open connection to the CMS DB
|
|
/// </summary>
|
|
/// <returns>Opened connection to the CMS DB</returns>
|
|
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;
|
|
}
|
|
}
|
|
}
|