In my very small C# application, I handle the SQL queries directly from the code using basic ADO.NET. I do not want to use an ORM, such as Entity Framework.
Now, I have a repository for CRUD operations. But I find I need flexibility for more complex queries.
For example, here is the (naive and simplified) process of logging into the application:
- The user types a password (no username, Windows style).
CountSQL-query counts the users with those credentials.
- If there is a user with those credentials, a users repository load the user's information from the database and retrieves a
Now, where should that
Count method be? It certainly can't be in the repository, so where should it be? Is there a pattern for handling such non-CRUD operations against the database?