Dealing with Validation – Domain vs Contextual

I’ve always found validation to be one of the most difficult and tedious aspects of writing enterprise software. No matter how you organize your rules, you are going to usually end up with duplication. To make matters worse, the rules aren’t written by developers, they are created by the business. This causes a disconnect between knowledge and domain experts, and the people who are implementing the validation in the code. As the rules change over time, and as the developers who originally worked on the system move on, the validation becomes increasingly difficult to manage. As the system matures, it ultimately ends up becoming a significant source of pain for all those involved. That’s assuming, of course, that you even have validation in the first place.
Continue reading “Dealing with Validation – Domain vs Contextual”

Request Injection in ASP.NET Core

I’ve created a Nuget package for this called RequestInjector if you are interested in using what is discussed in this post. Source code for the package can be found here.

These days, most people are familiar with dependency injection, and in the ASP.NET world, injecting into controllers. Less people probably are familiar with Jimmy Bogard’s Mediatr, and even fewer are probably familiar with directly injecting into the request objects. All of them are viable approaches to wiring up ASP.NET Core for dependency injection, but in my opinion, some approaches are better than others.
Continue reading “Request Injection in ASP.NET Core”