I have several data access level features
public Order RetrieveById(int id) public List<Order> RetrieveByStatus(OrderStatus status)
Now I'm a little confused about creating exceptions.
In the case of the RetrieveById function, an identifier that is less than 1 is an invalid identifier, so I feel like throwing an exception. And I want to return null for an Id that is not in the database. Then it seems to me that I'm complicating.
In the case of RetrieveByStatus, I want to return an empty list if the database does not have data for this status.
However, I saw some people throw an exception when RetrieveById cannot return anything, but then should RetrieveByStatus not raise an exception if there is no record or should it be?
Can someone clarify these concepts for me?
source share