I have fairly large API project. I want to rework it to be more clear and structured.
I never worked in large ASP.NET MVC projects, so I have a few questions which I can’t figure out on my own:
- What exactly is service used for? Should I put all business logic into or just specific parts? Should controller even have
DbContext
as direct dependency? - How to handle errors? I am fighting the urge to make some “error-value” class that would be json serializable end never raise an exceptions to not have billions of ways to get 500 from my API (I was working in rust previously), but if feel that future maintainers will have hard time working with this mess