Check out part 2 of the Advanced error handling techniques series.

This post shows how to combine ASP.NET validation attributes with DDD Value Objects for input validation such that you have the best of the two worlds:

  • Enjoy the declarativeness of ASP.NET validation attributes

  • Keep the domain knowledge DRY and concentrated in the domain layer

  • Simplify the controllers

In the next article, I’ll try to lay out a solution for gathering and returning to the client multiple errors. This is another problem that is hard to implement with proper encapsulation and without an excessive amount of code in each controller.

--Vlad

https://enterprisecraftsmanship.com