public DynamicGroupRuleSet(IEnumerable <IRuleset <TEntity> > ruleSets, EntryCriteriaRule <TEntity> entryPoint, IEnumerable <AggregatePropertyMetadata <TEntity> > aggregateProps, RuleEngineContext.RuleEngineContext context, string groupKey, string name, string description, IGroupKeyExpressionParser <TEntity> _groupKeyExpressionParser) : base(ruleSets, entryPoint, aggregateProps, context, groupKey, name, description) { _parsedExpression = _groupKeyExpressionParser.ParseGroupString(context, GroupKey); }
public LamdaGroupRuleSet (IEnumerable <IRuleset <TEntity> > ruleSets, EntryCriteriaRule <TEntity> entryPoint, IEnumerable <AggregatePropertyMetadata <TEntity> > aggregateProps, RuleEngineContext.RuleEngineContext context, Func <TEntity, TKey> keySelector, string name, string description) : base(ruleSets, entryPoint, aggregateProps, context, string.Empty, name, description) { _keySelector = keySelector; }
public IGroupRuleSet <TEntity> Compile() { CompilePlaceHolders(); EntryCriteriaRule <TEntity> entrycriteria = CreateEntryCriteria(); CompileAggregateProperty(); CompileChildRuleSet(); return(CreateGroupRuleSet(entrycriteria)); }
public IRuleset <TEntity> Compile() { CompilePlaceHolders(); EntryCriteriaRule <TEntity> entrycriteria = CreateEntryCriteria(); CreateRules(); CreateDefaultRule(); return(new Ruleset <TEntity> (_context, _rules, entrycriteria, _rulesExecutionRule, _name, _description)); }
internal Ruleset(RuleEngineContext.RuleEngineContext context, IEnumerable <IPropertyRule <TEntity> > rules, EntryCriteriaRule <TEntity> entryPoint, RuleExecutionRuleEnum ruleExecutionRule, string name, string description) { this._context = context; this._entryPoint = entryPoint; this._ruleExecutionRule = ruleExecutionRule; Name = name; Description = description; _rules.AddRange(rules); }
private IGroupRuleSet <TEntity> CreateGroupRuleSet(EntryCriteriaRule <TEntity> entrycriteria) { if (_keySelector != null) { return(new LamdaGroupRuleSet <TEntity, TKey>(_ruleSets, entrycriteria, _aggregateProps, _context, _keySelector, _name, _description)); } if (!string.IsNullOrEmpty(_groupKey)) { var parsedGroupKey = _groupKeyExpressionParser.ParseGroupString(_context, _groupKey); return(new LamdaGroupRuleSet <TEntity, object>(_ruleSets, entrycriteria, _aggregateProps, _context , t => parsedGroupKey.DynamicInvoke(t), _name, _description)); } return(new LamdaGroupRuleSet <TEntity, bool>(_ruleSets, entrycriteria, _aggregateProps, _context, t => true, _name, _description)); }
internal GroupRuleSet(IEnumerable <IRuleSet <TEntity> > ruleSets, EntryCriteriaRule <TEntity> entryPoint, RuleExecutionRuleEnum ruleExecutionRule, IEnumerable <AggregatePropertyMetadata> aggregateProps, string filterExpression, string groupExpression, string name, string description) { this.entryPoint = entryPoint; this.ruleExecutionRule = ruleExecutionRule; Name = name; Description = description; GroupExpression = groupExpression; _aggregateProps = aggregateProps; _ruleSets = ruleSets; _executedRuleSet = new List <IRuleSet <TEntity> >(); }
private EntryCriteriaRule <TEntity> CreateEntryCriteria() { EntryCriteriaRule <TEntity> entrycriteria = EntryCriteriaRule <TEntity> .TrueRule; if (!string.IsNullOrEmpty(_entryCriteria)) { entrycriteria = new EntryCriteriaRule <TEntity>(_context, _entryCriteria, _ruleparser.ParserRule(_context, _entryCriteria), EntryCriteriaRuleName()); } else if (_entryCriteriaRulefunc != null) { entrycriteria = new EntryCriteriaRule <TEntity>(_context, EntryCriteriaRuleName(), _entryCriteriaRulefunc, EntryCriteriaRuleName()); } return(entrycriteria); }
internal AbstractGroupRuleSet(IEnumerable <IRuleset <TEntity> > ruleSets, EntryCriteriaRule <TEntity> entryPoint, IEnumerable <AggregatePropertyMetadata <TEntity> > aggregateProps, RuleEngineContext.RuleEngineContext context, string groupKey, string name, string description) { this._entryPoint = entryPoint; Name = name; Description = description; GroupKey = groupKey; _aggregateProps = aggregateProps; this._context = context; _ruleSets = ruleSets; _executedRuleSet = new List <IRuleset <TEntity> >(); }