Create a simple command validator for annoying validation errors

Sometimes, unhandled validation errors occurs while processing commands. it will probably cause of latency under load.So,how can we prevent this?

Let’s try it. You can define a basic validation interface for all commands like that

And then , you can create a command validator for an every single command.

I used FluentValidator for Rule Engine.See AbstractValidator

Finally, You can register ICommandValidator to your container.

And you can validate an every single command at your publisher.


So, you do not have to worry about validation errors anymore.


Happy codings!



Leave a Reply

Your email address will not be published. Required fields are marked *