Exemplo n.º 1
0
        public void AddRule <T>(Expression <Func <T> > expression, Func <bool> rule, string message)
        {
            var propertyName = GetPropertyName(expression);

            if (_ruleMap.ContainsKey(propertyName))
            {
                _ruleMap[propertyName].AddRule(rule, message);
            }
            else
            {
                var binder = new Binder(propertyName);
                binder.AddRule(rule, message);
                _ruleMap.TryAdd(propertyName, binder);
            }
        }