public SqlFileProcessor(IRuleVisitor ruleVisitor, IPluginHandler pluginHandler, IReporter reporter, IFileSystem fileSystem) { this.ruleVisitor = ruleVisitor; this.pluginHandler = pluginHandler; this.reporter = reporter; this.fileSystem = fileSystem; }
public SqlFileProcessor(IRuleVisitor ruleVisitor, IPluginHandler pluginHandler, IReporter reporter, IFileSystem fileSystem) { _ruleVisitor = ruleVisitor; _pluginHandler = pluginHandler; _reporter = reporter; _fileSystem = fileSystem; }
public SqlFileProcessor(IRuleVisitor ruleVisitor, IPluginHandler pluginHandler, IReporter reporter, IFileSystem fileSystem) { this.ruleVisitor = ruleVisitor; this.pluginHandler = pluginHandler; this.reporter = reporter; this.fileSystem = fileSystem; ruleExceptionFinder = new RuleExceptionFinder(); }
private IRuleExpression CreateExpression(RuleEntity ruleEntity, IRuleVisitor visitor) { if (!ruleEntity.IsGroup) { return(visitor.VisitRule(ruleEntity)); } // It's a group, do recursive call var group = CreateExpressionGroup(ruleEntity.Value.Convert <int>(), visitor); group.RefRuleId = ruleEntity.Id; return(group); }
private async Task <IRuleExpression> CreateExpression(RuleEntity ruleEntity, IRuleVisitor visitor) { if (!ruleEntity.IsGroup) { return(await visitor.VisitRuleAsync(ruleEntity)); } // It's a group, do recursive call. var group = await CreateExpressionGroupAsync(ruleEntity.Value.Convert <int>(), visitor); if (group != null) { group.RefRuleId = ruleEntity.Id; } return(group); }
public IRuleExpressionGroup CreateExpressionGroup(int ruleSetId, IRuleVisitor visitor) { if (ruleSetId <= 0) { return(null); } // TODO: prevent stack overflow > check if nested groups reference each other. var ruleSet = _storage.GetCachedRuleSet(ruleSetId); if (ruleSet == null) { // TODO: ErrHandling (???) return(null); } return(CreateExpressionGroup(ruleSet, visitor)); }
public override TResult Accept <TResult, TContext>( IRuleVisitor <TResult, TContext> visitor, TContext environment) { return(visitor.Visit(this, environment)); }
public SqlFileProcessor(IRuleVisitor ruleVisitor, IBaseReporter reporter, IFileSystem fileSystem) { _ruleVisitor = ruleVisitor; _reporter = reporter; _fileSystem = fileSystem; }
public SqlFileProcessor(IRuleVisitor ruleVisitor, IBaseReporter reporter) : this(ruleVisitor, reporter, new FileSystem()) { }
public TargetGroupFilterDescriptor(IRuleFactory ruleFactory, IRuleVisitor ruleVisitor) : base(x => true) { _ruleFactory = ruleFactory; _ruleVisitor = new WeakReference <IRuleVisitor>(ruleVisitor); }
public abstract TResult Accept <TResult, TContext>(IRuleVisitor <TResult, TContext> visitor, TContext environment) where TContext : IEnvironment;
private IRuleExpressionGroup CreateExpressionGroup(RuleSetEntity ruleSet, RuleEntity refRule, IRuleVisitor visitor) { if (ruleSet.Scope != visitor.Scope) { // TODO: ErrHandling (ruleSet is for a different scope) return(null); } var group = visitor.VisitRuleSet(ruleSet); if (refRule != null) { group.RefRuleId = refRule.Id; } var expressions = ruleSet.Rules .Select(x => CreateExpression(x, visitor)) .Where(x => x != null) .ToArray(); group.AddExpressions(expressions); return(group); }
public virtual async Task <IRuleExpressionGroup> CreateExpressionGroupAsync(RuleSetEntity ruleSet, IRuleVisitor visitor, bool includeHidden = false) { if (ruleSet.Scope != visitor.Scope) { throw new SmartException($"Differing rule scope {ruleSet.Scope}. Expected {visitor.Scope}."); } if (!includeHidden && !ruleSet.IsActive) { return(null); } var group = visitor.VisitRuleSet(ruleSet); var expressions = await ruleSet.Rules .SelectAsync(x => CreateExpression(x, visitor)) .Where(x => x != null) .AsyncToArray(); group.AddExpressions(expressions); return(group); }
public async Task <IRuleExpressionGroup> CreateExpressionGroupAsync(int ruleSetId, IRuleVisitor visitor, bool includeHidden = false) { if (ruleSetId <= 0) { return(null); } // TODO: prevent stack overflow > check if nested groups reference each other. var ruleSet = await _db.RuleSets .AsNoTracking() .Include(x => x.Rules) .FirstOrDefaultAsync(x => x.Id == ruleSetId); if (ruleSet == null) { // TODO: ErrHandling (???) return(null); } return(await CreateExpressionGroupAsync(ruleSet, visitor, includeHidden)); }
public TargetGroupFilterDescriptor(IRuleService ruleService, IRuleVisitor ruleVisitor) : base(x => true) { _ruleService = ruleService; _ruleVisitor = new WeakReference <IRuleVisitor>(ruleVisitor); }