lundi 20 mai 2019

Is there a convention where to save common definitions

I am creating a C# program (This question is general for any OOP language) which includes several logic parts, each is meant to deal with some service the program requires. For example, a database handler which is responsible for getting results from the database, a web service handler which is responsible for getting results from the web service etc...

Let's say the db has a table which contains a column with some enum values. The program can read these values which of course will be in the form of the enum. So this enum was specifically created for the db use, but is readable for several parts.

Where should this enum be defined in the OOP program side:

1) Should there be a general definition file which contains all definitions of common classes, types, enums etc.

2) Should there be several definitions files, one for each part? so the enum in this case will be defined in the db's definition file.

3) something else completely?

Aucun commentaire:

Enregistrer un commentaire