I have this class that connects to my oracle database:
public class Conexao : IDisposable
{
private readonly IOptions<Configuracao> _config;
public OracleConnection ConexaoOra{ get; internal set; }
private OracleTransaction _transacao;
private bool _finalized;
private bool _commited;
private const string CONNECTION_STRING = "myConnectionString";
public Conexao(IOptions<Configuracao> config)
{
_config = config;
_finalized = false;
_commited = false;
ConexaoOra = new OracleConnection();
ConexaoOra.ConnectionString = CONNECTION_STRING;
ConexaoOra.Open();
}
~Conexao()
{
Dispose();
}
public void BeginTransaction(System.Data.IsolationLevel level = System.Data.IsolationLevel.ReadCommitted)
{
_transacao = ConexaoOra.BeginTransaction(level);
}
public void Commit()
{
if (_transacao != null)
{
_transacao.Commit();
_transacao = null;
}
_commited = true;
}
}
This class is instantiated every time any transaction is triggered in the DAL class
sample:
using ((conexao == null ? conexao = new Conexao() : conexao))
OracleCommand oracleCommand = new OracleCommand("", conexao.ConexaoOra);
//...
The Json Settings File and the Connection Class are in different projects in the same solution
how to load in this line my connectionString of appSettings Json File?
private const string CONNECTION_STRING = "myConnectionString";