Ejemplo n.º 1
0
 public MonitorBehaviorFactory(ILoggingConfiguration configuration, IDomainContext context, IRulesCompiler compiler)
 {
     var application = context.Applications.Get(configuration.ApplicationId);
     var result = compiler.Compile(application.LoggingRules);
     if (!result.Success)
     {
         var messages = result.Errors.Select(x => "{0} ({1},{2})".Args(x.Message, x.Line, x.Column)).ToArray();
         throw new RulesCompilationException(String.Join(" | ", messages));
     }
     _rules = new List<IRule>(result.Rules);
 }
Ejemplo n.º 2
0
 public RulesService(IRulesCompiler compiler, IAppCache cache)
 {
     _compiler = compiler ?? throw new ArgumentNullException(nameof(compiler));
     _cache    = cache ?? throw new ArgumentNullException(nameof(cache));
 }