protected CollectionTemplateFactory(params ITemplateFactory <TemplateContainer, TInTemplate>[] factories) { EnsureArg.IsNotNull(factories, nameof(factories)); EnsureArg.HasItems(factories, nameof(factories)); IResponsibilityHandler <TemplateContainer, TInTemplate> handler = new WrappedHandlerTemplateFactory <TemplateContainer, TInTemplate>(factories[0]); for (int i = 1; i < factories.Length; i++) { handler = handler.Chain(new WrappedHandlerTemplateFactory <TemplateContainer, TInTemplate>(factories[i])); } // Attach NotFoundHandler at the end of the chain to throw exception if we reach end with no factory found. _templateFactories = handler.Chain(NotFoundHandler); }
public NullNextResponsibilityHandler(IResponsibilityHandler <TRequest, TResult> predecessor, IResponsibilityHandler <TRequest, TResult> succesor) { _predecessor = predecessor; _succesor = succesor; }
public static IResponsibilityHandler <TRequest, TResult> Chain <TRequest, TResult>(this IResponsibilityHandler <TRequest, TResult> link, IResponsibilityHandler <TRequest, TResult> successor) where TResult : class { return(new NullNextResponsibilityHandler <TRequest, TResult>(link, successor)); }
public IResponsibilityHandler SetNext(IResponsibilityHandler handler) { this._nextHandler = handler; return(handler); }