Beispiel #1
0
        public IProxyConfig <T> When(Func <MethodInfo, bool> predicate, Action <IPolicyConfig> policyConfig)
        {
            var cfg = new PolicyConfig();

            policyConfig.Invoke(cfg);
            _policyMapping.Add(mi => predicate.Invoke(mi) ? cfg._policy : null);
            return(this);
        }
Beispiel #2
0
        public IProxyConfig <T> For(string methodName, Action <IPolicyConfig> policyConfig)
        {
            var cfg = new PolicyConfig();

            policyConfig.Invoke(cfg);
            _policyMapping.Add(mi => mi.Name == methodName ? cfg._policy : null);
            return(this);
        }
Beispiel #3
0
        public IProxyConfig <T> For(Expression <Action <T> > methodExpression, Action <IPolicyConfig> policyConfig)
        {
            var cfg = new PolicyConfig();

            policyConfig.Invoke(cfg);
            var methodCall = methodExpression.Body as MethodCallExpression;

            if (methodCall != null)
            {
                _policyMapping.Add(mi => mi == methodCall.Method ? cfg._policy : null);
            }
            return(this);
        }