jeudi 17 août 2017

What should a repository consist of?

I'm getting thrown in the fire a little bit on a new project that implements the repository pattern and I'm having a little trouble grasping what a repository should consist of. I tend to think of things in terms of SQL Server database tables so any explanation going from the tables up would be helpful.

We are building a small registration site that has tables such as:

RegistrationTable (Stores details about the registration itself)
RegisrationContactTable (Stores names and addresses associated with the registration)
States
Counties

How do these relate to a repository though? Should there be 4 repositories, one for each table with a module class/service that sits on top and communicates with the 4 repositories to pull all the data together into a single registration module? Or Do I create one repository that does all the granular operations such as selecting a list of states or a list of counties for a given state and also the cross table operations like doing the insert to complete the overall registration process? I'm just wondering what the best practice approach is and why it's the best practice. If you have any other suggested reading that would be welcomed as well.

Aucun commentaire:

Enregistrer un commentaire