protected internal override IEnumerable<SitemapNode> GetSitemapNodes(UrlHelper urlHelper, HttpContextBase httpContext)
            {
                yield return new SitemapNode(urlHelper.Action("Index", "Expression")) { Priority = 0.8m };

                var repo = new RealDataRepo();

                foreach (var expression in repo.GetExpressions())
                {
                    yield return new SitemapNode(urlHelper.Action("Expression", "Expression", new { expressionName = expression.Name })) { Priority = 0.50m };
                }

                foreach (var keyword in repo.GetKeywords())
                {
                    yield return new SitemapNode(urlHelper.Action("Keyword", "Expression", new { keywordName = keyword.Name })) { Priority = 0.50m };
                }
            }
Ejemplo n.º 2
0
            protected internal override IEnumerable<SitemapNode> GetSitemapNodes(UrlHelper urlHelper, HttpContextBase httpContext)
            {
                yield return new SitemapNode(urlHelper.Action("Index", "Library")) { Priority = 0.8m };

                var repo = new RealDataRepo();

                foreach (var @class in repo.GetClasses())
                {
                    yield return new SitemapNode(urlHelper.Action("Class", "Library", new { className = @class.Name })) { Priority = 0.75m };

                    foreach (var methodGrp in @class.Methods.GroupBy(x => new { x.Name, x.Frameworks }))
                    {
                        int methodCount = 0;

                        foreach (var method in methodGrp)
                        {
                            Frameworks? framework = null;

                            if (method.Frameworks != Frameworks.All)
                            {
                                framework = Enum.GetValues(typeof(Frameworks)).Cast<Frameworks>().Reverse().Where(x => method.Frameworks.HasFlag(x)).FirstOrDefault();
                            }

                            var methodUrl = urlHelper.Action("Method", "Library", new { className = @class.Name, methodName = method.Name.Replace('<', '(').Replace('>', ')'), framework = framework, o = methodCount > 0 ? (int?)methodCount : null }, null);

                            yield return new SitemapNode(methodUrl) { Priority = .5m };

                            methodCount++;
                        }
                    }

                    foreach (var property in @class.Properties)
                    {
                        Frameworks? framework = null;

                        if (property.Frameworks != Frameworks.All)
                        {
                            framework = Enum.GetValues(typeof(Frameworks)).Cast<Frameworks>().Reverse().Where(x => property.Frameworks.HasFlag(x)).FirstOrDefault();
                        }

                        var propertyUrl = urlHelper.Action("Property", "Library", new { className = @class.Name, propertyName = property.Name, framework = framework });

                        yield return new SitemapNode(propertyUrl) { Priority = .5m };
                    }
                }
            }