public virtual void Attach(IViewProfile viewProfile, ViewBag bag, ActionCall action) { // No duplicate views! var outputNode = action.ParentChain().Output; if (outputNode.HasView(viewProfile.ConditionType)) { return; } var log = new ViewAttachmentLog(viewProfile); action.Trace(log); foreach (var filter in filters()) { var viewTokens = filter.Apply(action, bag); var count = viewTokens.Count(); if (count > 0) { log.FoundViews(filter, viewTokens.Select(x => x.Resolve())); } if (count != 1) { continue; } var token = viewTokens.Single().Resolve(); outputNode.AddView(token, viewProfile.ConditionType); break; } }
public virtual void Attach(IViewProfile viewProfile, ViewBag bag, ActionCall action) { // No duplicate views! var outputNode = action.ParentChain().Output; if (outputNode.HasView(viewProfile.ConditionType)) return; var log = new ViewAttachmentLog(viewProfile); action.Trace(log); foreach (var filter in _filters) { var viewTokens = filter.Apply(action, bag); var count = viewTokens.Count(); if (count > 0) { log.FoundViews(filter, viewTokens.Select(x => x.Resolve())); } if (count != 1) continue; var token = viewTokens.Single().Resolve(); outputNode.AddView(token, viewProfile.ConditionType); break; } }