public void Apply(BehaviorGraph graph, BehaviorChain chain)
        {
            ActionCall call = chain.Calls.FirstOrDefault();
            if (call == null) return;

            IUrlPolicy policy = _policies.FirstOrDefault(x => x.Matches(call)) ?? _defaultUrlPolicy;
            IRouteDefinition route = policy.Build(call);
            _constraintPolicy.Apply(call, route);
            graph.RegisterRoute(chain, route);
        }
        public void Apply(BehaviorGraph graph, BehaviorChain chain)
        {
            var log = graph.Observer;

            ActionCall call = chain.Calls.FirstOrDefault();
            if (call == null) return;

            IUrlPolicy policy = _policies.FirstOrDefault(x => x.Matches(call)) ?? _defaultUrlPolicy;
            log.RecordCallStatus(call, "First matching UrlPolicy (or default): {0}".ToFormat(policy.GetType().Name));
            IRouteDefinition route = policy.Build(call);
            _constraintPolicy.Apply(call, route, log);
            log.RecordCallStatus(call, "Route definition determined by url policy: [{0}]".ToFormat(route.ToRoute().Url));
            graph.RegisterRoute(chain, route);
        }