Get the source code for this video for FREE → https://the-dotnet-weekly.ck.page/result-pattern
☄️ Master the Modular Monolith Architecture: https://bit.ly/3SXlzSt
📌 Accelerate your Clean Architecture skills: https://bit.ly/3PupkOJ
🚀 Support me on Patreon to access the source code: https://www.patreon.com/milanjovanovic
I will show you two approaches for Domain validation with .NET. The first approach will be based on throwing exceptions. The second approach will be based on returning a result object. I'll show you how to extend the Result pattern with errors and clean up your design. It's more performant and expressive than throwing exceptions.
Which validation approach would you choose? I prefer expressing errors using the Result pattern.
Join my weekly .NET newsletter:
https://www.milanjovanovic.tech
Read my Blog here:
https://www.milanjovanovic.tech/blog
Chapters
0:00 Why I don't prefer throwing exceptions
2:36 Returning error messages instead of throwing exceptions
3:31 Adding an Error type express errors in the domain
5:44 Documenting domain errors for a better design
7:48 Using a Result object to represent success or failure