Esempio n. 1
0
        public List<Node> BuildTree(RequestContext context)
        {
            _root.Cleanup();

            var result = new List<Node>();

            var searchData = new NodeData(context);
            var node = _root.FindNode(searchData);
            if (node != null) {
                result.Insert(node, context);

                node = node.Parent;
                while (node != null) {
                    result.Insert(node, context);
                    node = node.Parent;
                }
            }

            if (!result.Any()) {
                const string template = "Node was not found in the tree (area={0}, controller={1}, action={2})";
                var values = context.RouteData.Values;
                throw new MvcBreadcrumbsException(string.Format(template, values.GetValue("area"), values.GetValue("controller"), values.GetValue("action")));
            }

            return result;
        }
Esempio n. 2
0
 public bool Equals(NodeData other)
 {
     if (ReferenceEquals(null, other)) return false;
     if (ReferenceEquals(this, other)) return true;
     return string.Compare(Area, other.Area, true) == 0 &&
            string.Compare(Controller, other.Controller, true) == 0 &&
            string.Compare(Action, other.Action, true) == 0;
 }
Esempio n. 3
0
 public abstract Node FindNode(NodeData searchData);