Validation Module¶
The ValidationModule
includes tools and components to configure and run validation tasks in an easy way. The module is currently focused on validations that must run before the applications starts, that way they can be handled correctly to ensure our service starts in the required conditions.
This kind of validations are represented by an IStartupValidation
. This interface provides a single Validate
method, which encapsulates our validation logic, and returns a ValidationResult
.
Validations will be run sequentially before the application starts. Validation results will then be handled by a ValidationResultHandler
instance according to the configured validation behavior. This can be configured when depending on the ValidationModule
. There's currently two possible configurable behaviors for validation results with Error
type.
Exception
will trigger an exception with the provided result message.Warning
will log the provided message at information level.
C# | |
---|---|
Info
ValidationBehavior
can only be configured globally, as for now. This meas that all validations run will be handled in the same fashion. This is a known limitation that will be addressed in the future.