vendredi 15 janvier 2016

In service layer, each class per table or one class per database?

The applications I work on structured like this. Data > Service/Business Logic > View.

Data layer just talks to mysql database and returns data

Service layer has all the business rules and communicates with the data layer and returns it to the view. I usually see only one service class per the database. Example an inventory database has item, category, and item usage tables. Would it make more sense to have one service class that does operations for all these tables or have individual service classes? The models are just poco's in this example.

Advantage with one service class - easy communication between different table operations

Disadvantage with one service class - class gets too long

Aucun commentaire:

Enregistrer un commentaire