I am mounting a database access layer and need to access the functions inside a package on the oracle server.
The orm already connects to the database and accesses tables and procedures through their respective repositories and entities.
I thought about creating a class of service with several return classes and methods mapping the functions, as in the model below:
public class RetornoMetodoA
{
public string ValorA { get; set; }
public int ValorB { get; set; }
}
public class RetornoMetodoB
{
public string ValorA { get; set; }
}
public class PacoteSQLServico
{
public RetornoMetodoA Funcao1(string parametro1)
{
var retorno = new RetornoMetodoA();
//Acessa o banco e roda a função do package
// exec PacoteSQLServico.Funcao1(parametro1)
return retorno;
}
public RetornoMetodoB Funcao2(string parametro1, string parametro2)
{
var retorno = new RetornoMetodoB();
//Acessa o banco e roda a função
// exec PacoteSQLServico.Funcao2(parametro1, parametro2)
return retorno;
}
}
In terms of code design, what would be the best way to do this?