I have a SalesmanRepository that simply lists all the salesmen from my database. I want to display the result in a grid (imagine a Web interface), so the user can display or hide any field, sort a column and use paging.
Let's assume I have a very large set, so the sorting and paging must be server-side.
My question is, how can I stay loosely-coupled in my architecture?
- I don't want my database column's name to the binded to the UI's columns. I want to have the flexibility to change for a new type of database later.
- How should I handle paging? By adding parameters such as
pageandnumberOfItemsPerPagedirectly to the repository's method for example? - How should I approach sorting as well? I don't want either to bind the database column's name to the sorting parameter, as in I could have a new type of database and I would break all my software.
Basically, how can I approach these concept and stay loosely coupled? Ideally, I would like a language-agnostic approach, but I'm using C# if there is a better language-specific answer.
Aucun commentaire:
Enregistrer un commentaire