2 results found
An error occurred while saving the comment
An error occurred while saving the commentwwwlicious commented
The way this is recommended to be handled in FluentValidator is to create a custom base class
public abstract class AbstactSharedPropertyValidator : AbstractValidator<IHaveSharedProperty>
Then implement this for each DTO where applicable.This avoids potential ordering issues with cascading rules and knowing which should be applied first. It is for this reason that validation is usually explicit to the concrete implementation.
public class MessageWithSharedProperyValidator : AbstactSharedPropertyValidator <MessageWithSharedProperty>
Whilst you still have to create validators for each concrete class, you can avoid duplicating validation logic in them by putting it in the base class.
Hope that helps.
We have a plugin for consul, a distributed k/v store that allows you to change servicestack configuration at runtime
Hope this helps