We're using an internally-built ORM. Each table is represented by a Model class, which inherits from a base model class that has a handful of methods like GetAll, GetWhere (to get rows with specified column values), GetFirstWhere, etc. to access data from the table. There's a question of whether these methods should be protected (so that any database access needs to call a public wrapper method for the exact query) or public methods (so that code anywhere can call GetAll, GetWhere, etc.)
I see some pros and cons for both sides. Which style would be considered best practice and more maintainable?
Pros: it's easy to see all queries against a table, just open the Model file. This could be useful for checking whether the table is indexed properly, etc.
Cons: extra work and cognitive overhead for every data access. I now have to check whether a query method already exists and create it if not; I have to look up method names, which tend to be specific like "GetThisThingByIDAndName"; also, if I want to change a query, I need to make sure nothing else was using that method or create a new method. Many of these queries are only ever going to be used once, and in practice there end up being tons of these methods whose names don't always clarify exactly what the method does.
Pros: the standardized data access interface allows developers to easily memorize the few data access methods and use them consistently across tables, which makes development faster and simpler. Also, they can make changes directly where the query is taking place without breaking something elsewhere in the codebase.
Cons: requires a search to find all queries against a table. If not careful, there could be some duplication.