Aug 03, 2019 08:28 AM|Gluups|LINK
I write WebAPI projects with Microsoft.EntityFrameworkCore.
Data goes through an Interface, a Repository, and a Controller.
I have got the habit to put a try ... catch in the repository, if I remember correctly I saw that this way in the documentation.
But suddenly I am wondering ...
Probably that is not a good idea, for that way I have the same result for an error or a non existing record.
Maybe it would be better that the repository throws an exception to the controller, which then has the possibility to distinguish between NotFound and BadRequest.
Am I pushing an open door ?