Posts

Showing posts from June, 2023

Ensuring Data Quality with Command Handler Validators

In the realm of software development, ensuring the quality of the data you're handling is paramount. With the rise of Microservices, CQRS (Command Query Responsibility Segregation) and Mediator patterns, developers now, more than ever, need a reliable mechanism to validate data before processing it. Enter Command Handler Validators - a mechanism to validate command objects before they're handled. In this blog post, we'll discuss how to implement a Command Handler Validator using MediatR, FluentValidation, and ASP.NET Core. A Practical Example Consider the following code for creating a new customer: public class CreateCustomerCommand : IRequest { public string FirstName { get; set; } public string LastName { get; set; } public string Email { get; set; } } The CreateCustomerCommand command is then handled by CreateCustomerCommandHandler: public class CreateCustomerCommandHandler : IRequestHandler { public async Task Handle(CreateCustomerCo...

Ensuring Data Quality with Command Handler Validators

In the realm of software development, ensuring the quality of the data you're handling is paramount. With the rise of Microservices, CQRS (Command Query Responsibility Segregation) and Mediator patterns, developers now, more than ever, need a reliable mechanism to validate data before processing it. Enter Command Handler Validators - a mechanism to validate command objects before they're handled. In this blog post, we'll discuss how to implement a Command Handler Validator using MediatR, FluentValidation, and ASP.NET Core. A Practical Example Consider the following code for creating a new customer: public class CreateCustomerCommand : IRequest { public string FirstName { get; set; } public string LastName { get; set; } public string Email { get; set; } } The CreateCustomerCommand command is then handled by CreateCustomerCommandHandler: public class CreateCustomerCommandHandler : IRequestHandler { public async Task Handle(CreateCustomerCo...

Popular posts from this blog

Ensuring Data Quality with Command Handler Validators

Enhancing Functionality with the Decorator Pattern in .NET

Supercharge Your Unit Testing with MOQ, Dependency Injection, and Fluent Assertions