Validattion in Domain layer Clean Architucture

Arian A 1 Reputation point
2021-05-17T20:19:01.27+00:00

Im working on a API. In the domain layer, I have a method Public UserModel GetUser(int id)

. If the user is not found i want to return a 404. the issue is im supposed to return a UserModel how is validations done in the domain layer in Clean Architecture?
If i validate everything in controller i could get away with it just fine, but how can it be done in the Domain Layer?

ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
4,158 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Duane Arnold 3,211 Reputation points
    2021-05-18T12:28:46.563+00:00

    You would have a class that's in the Models folder the controller calls the method on the class.

    0 comments No comments