Suppose there is a database and the interaction with it is performed through some kind of ORM.
Actually, the question is how to properly hide it from the outside world, but not to the detriment of usability and so that at any moment it can be easily changed to another?
I see a solution in the form of some kind of service in which some method is twitching and it returns some kind of result. However, the problem with this approach is that many methods of the GetBy* type can ultimately come up, although if you work directly with ORM, you can filter everything on the fly in LINQ style without creating an add. methods.
Another solution is to expose Enumerable , but in that case, if I am not mistaken, the data will completely materialize, which is not good, but there will be flexibility comparable to direct interaction through ORM ...