Best way to build a class to run an SQL package

Asked

Viewed 28 times

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

  • I edited and tried to make more clear my doubt that it is in relation to code design

  • 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!

  • 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.

  • 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?

  • But I have already set the example above.

  • 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 !

Show 3 more comments
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.