コード例 #1
0
        public RuleChainBuilder <TObject, TSelectorResult> HasRule(Func <TSelectorResult, bool> predicate)
        {
            RuleChain.AddNode(new Rule <TObject, TSelectorResult>
            {
                Selector  = selector,
                Predicate = predicate
            });

            return(this);
        }
コード例 #2
0
        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);
        }
コード例 #3
0
        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);
        }