示例#1
0
        public BouncerPolicy([NotNull] Expression <Func <T, bool> > policy, [NotNull] Func <T, string> createMessage, BouncerPolicyOptions options)
        {
            if (policy == null)
            {
                throw new ArgumentNullException(nameof(policy));
            }

            _policy           = Lazy.Create(policy.Compile);
            _expressionString = Lazy.Create(BouncerPolicyExpressionPrettifier.Prettify(policy).ToString);
            _createMessage    = createMessage ?? throw new ArgumentNullException(nameof(createMessage));
            Options           = options;
        }
示例#2
0
 public BouncerPolicyBuilder <T> BreakOnFailure()
 {
     _options |= BouncerPolicyOptions.BreakOnFailure;
     return(this);
 }