public RuleChainBuilder <TObject, TSelectorResult> HasRule(Func <TSelectorResult, bool> predicate) { RuleChain.AddNode(new Rule <TObject, TSelectorResult> { Selector = selector, Predicate = predicate }); return(this); }
private RuleChainBuilder <TObject, TSelectorResult, TError> CreateChainBuilder <TSelectorResult>( Func <TObject, TSelectorResult> selector) { var builder = new RuleChainBuilder <TObject, TSelectorResult, TError>(selector); if (chainOfChains == null) { chainOfChains = new RuleChain <TObject, TError>(); } chainOfChains.AddNode(builder.RuleChain); ruleChainBuilder = builder; return(builder); }
public RuleChainBuilder <TObject, TSelectorResult, TError> HasRule( Func <TSelectorResult, bool> predicate, Func <TError> errorCreator, bool stopValidationOnError = false, bool terminateValidationOnError = false) { RuleChain.AddNode(new Rule <TObject, TSelectorResult, TError> { Selector = selector, Predicate = predicate, ErrorCreator = errorCreator, StopValidationOnError = stopValidationOnError, TerminateValidationOnError = terminateValidationOnError }); return(this); }