public IOrderPolicyExpression WrapBehaviorChainsWith <T>() where T : IActionBehavior { var configAction = new VisitBehaviorsAction(v => v.Actions += chain => chain.Prepend(new Wrapper(typeof(T))), "wrap with the {0} behavior".ToFormat(typeof(T).Name)); return(applyWrapper <T>(configAction)); }
private IOrderPolicyExpression applyWrapper <T>(VisitBehaviorsAction configAction) { _actions.Fill(configAction); _lastNodeMatch = ReorderBehaviorsPolicy.FuncForWrapper(typeof(T)); return(this); }
private IOrderPolicyExpression applyWrapper <T>(VisitBehaviorsAction configAction) { _configuration.AddConfiguration(configAction, ConfigurationType.Policy); _lastNodeMatch = ReorderBehaviorsPolicy.FuncForWrapper(typeof(T)); return(this); }
public IOrderPolicyExpression ConditionallyWrapBehaviorChainsWith <T>(Expression <Func <ActionCall, bool> > filter) where T : IActionBehavior { var reason = "wrap with the {0} behavior if [{1}]".ToFormat(typeof(T).Name, filter.Body.ToString()); var chainFilter = filter.Compile(); var configAction = new VisitBehaviorsAction(v => { v.Filters += chain => chain.FirstCall() != null && chainFilter(chain.FirstCall()); v.Actions += chain => chain.Prepend(new Wrapper(typeof(T))); }, reason); return(applyWrapper <T>(configAction)); }