Esempio n. 1
0
 public RulesEngine(ExpressionCache expressionCache)
 {
     if (expressionCache == null)
     {
         throw new ArgumentNullException("expressionCache");
     }
     _expressionCache = expressionCache;
 }
 public PropertyValidationReport(ExpressionCache expressionCache)
 {
     if (expressionCache == null)
     {
         throw new System.ArgumentNullException("expressionCache");
     }
     _expressionCache = expressionCache;
 }
Esempio n. 3
0
 /// <summary>
 /// Creates a Rules Engine.
 /// </summary>
 /// <param name="basedOn">Copies rules from base Engine</param>
 public RulesEngine(RulesEngine basedOn)
 {
     if (basedOn == null)
     {
         throw new ArgumentNullException("basedOn");
     }
     _registry        = basedOn._registry.Clone();
     _expressionCache = basedOn._expressionCache;
 }
Esempio n. 4
0
        /// <summary>
        /// Creates a Rules Engine.
        /// </summary>
        /// <param name="basedOn">Copies specific rules from base Engine</param>
        /// <param name="types">Copies rules for the specified types only.</param>
        public RulesEngine(RulesEngine basedOn, params Type[] types)
        {
            if (types == null)
            {
                throw new ArgumentNullException("types");
            }
            if (basedOn == null)
            {
                throw new ArgumentNullException("basedOn");
            }

            var registry = basedOn._registry.Clone();

            _expressionCache = basedOn._expressionCache;

            foreach (var type in types)
            {
                var invokers = registry.GetInvokers(type);
                foreach (var invoker in invokers)
                {
                    _registry.RegisterInvoker(invoker);
                }
            }
        }
 public PropertyValidationReport()
 {
     this.expressionCache = RulesEngine.DefaultExpressionCache;
 }
Esempio n. 6
0
 public RulesEngine()
 {
     _expressionCache = _defaultExpressionCache;
 }
Esempio n. 7
0
 static RulesEngine()
 {
     // Create a default ExpressionCache, ignoring lambda parameter names.
     DefaultExpressionCache = new ExpressionCache(new ExpressionComparerIgnoreLambdaParameterNames());
 }