How should my business logic interact with my data layer?
So I'm working on making a draft of my program.

This is my plan:

    GUI
    ---
    Business Logic
    ---
    Data

You should be able to replace either `GUI` or the `Data` layer without issues.
Every layer watches itself. So `GUI` will call methods from `Business logic` and the methods will always return a status and perhaps some data. How the GUI should respond to the data, should always be decided in the GUI layer. Business logic should have no influence over this.
So the relations with GUI and business logic has been solved.
I hope you can follow me.

Now for something more concrete.
My plan for the data layer, is to use an database.
Now, how should Business Logic call methods from the data layer?

Perhaps I should make an enum, that corresponds to different hardcoded SQL queries, which the data layer is aware of?

E.g.

    Datalayer.GetResults(Queries.GetAllCustomersIDs);

Queries being an enum.

If this is the right way, what should GetResults return? a string array? but what if the query has multidimensional data?

Should I then have 2 generic methods instead?

    Datalayer.GetSingleDimensionResults(SingleDimensionQueries.GetAllCustomersIDs);
    Datalayer.GetMultipleDimensionResults(MultiDimensionQueries.GetAllCustomers);

Or should I perhaps have a query for each kind of data request?

    Datalayer.GetAllCustomerIDs;
    DataLayer.GetAllCustomers;

etc.



How should my business logic interact with my data layer?
===

So I'm working on making a draft of my program.

This is my plan:

    GUI
    ---
    Business Logic
    ---
    Data

You should be able to replace either `GUI` or the `Data` layer without issues.
Every layer watches itself. So `GUI` will call methods from `Business logic` and the methods will always return a status and perhaps some data. How the GUI should respond to the data, should always be decided in the GUI layer. Business logic should have no influence over this.
So the relations with GUI and business logic has been solved.
I hope you can follow me.

Now for something more concrete.
My plan for the data layer, is to use an database.
Now, how should Business Logic call methods from the data layer?

Perhaps I should make an enum, that corresponds to different hardcoded SQL queries, which the data layer is aware of?

E.g.

    Datalayer.GetResults(Queries.GetAllCustomersIDs);

Queries being an enum.

If this is the right way, what should GetResults return? a string array? but what if the query has multidimensional data?

Should I then have 2 generic methods instead?

    Datalayer.GetSingleDimensionResults(SingleDimensionQueries.GetAllCustomersIDs);
    Datalayer.GetMultipleDimensionResults(MultiDimensionQueries.GetAllCustomers);

Or should I perhaps have a query for each kind of data request?

    Datalayer.GetAllCustomerIDs;
    DataLayer.GetAllCustomers;

etc.


