0
I am building a layer of access to the database and I need to access the functions inside a package on the oracle server.
Orm already connects to the database and accesses tables and procedures through their respective repositories and entities.
I thought of creating a service class with several return classes and methods mapping 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 that?
It’s a bit confusing the question, without beginning, middle and end! could explain better
– novic
I edited and tried to make more clear my doubt that it is in relation to code design
– dipi evil
You have to see if this is possible, so right away I know you can! functions have a form as well, but, it is very broad your question for not focusing on an item. could create your question through an item a function of the type and what you have tried to do!
– novic
Yes. I create an oracle command and make the call with the "nomedopacote.nomedafuncao". The question is what is the best design to assemble this package and not leave everything inside a string.
– dipi evil
I know it’s even possible as I had already reported, now it’s kind of guesswork at your question, by not having a real thing, and if your question is about opinion it can be closed, by being based on opinions understood. Why not put in your question the example made?
– novic
But I have already set the example above.
– dipi evil
He put an example that in my view is not the reality of the function that is in the Oracle and its ORM, nor did he say which is the ORM and how he did this process ... see, many variables are missing to answer his question. good !
– novic
Let’s go continue this discussion in chat.
– dipi evil