wwwlicious
My feedback
2 results found
-
3 votes
An error occurred while saving the comment -
4 votes
An error occurred while saving the comment wwwlicious 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
https://github.com/MacLeanElectrical/servicestack-configuration-consul
Hope this helps