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; }
public BouncerPolicyBuilder <T> BreakOnFailure() { _options |= BouncerPolicyOptions.BreakOnFailure; return(this); }