示例#1
0
        public static DslModel Build(DocumentModel model)
        {
            Dictionary <string, SummaryComment> summaries;
            var data = GetData(model, out summaries);

            var categories = new List <DslCategory>();

            foreach (var categoryName in data.Keys)
            {
                var metadata = (IDocumentationMetadata)null;

                var categoryMethods = new List <DocumentedMethod>();
                var subCategories   = new List <DslSubCategory>();
                foreach (var subCategoryName in data[categoryName].Keys)
                {
                    var methods = data[categoryName][subCategoryName];
                    if (string.IsNullOrWhiteSpace(subCategoryName))
                    {
                        categoryMethods.AddRange(methods.OrderBy(x => x.Identity));
                    }
                    else
                    {
                        subCategories.Add(new DslSubCategory(subCategoryName, methods));
                    }

                    if (metadata == null)
                    {
                        metadata = methods.First().Metadata;
                    }
                }

                SummaryComment summary = null;
                if (summaries.ContainsKey(categoryName))
                {
                    summary = summaries[categoryName];
                }

                categories.Add(
                    new DslCategory(
                        categoryName,
                        metadata,
                        summary,
                        categoryMethods,
                        subCategories.OrderBy(x => x.Name)));
            }

            var dslModel = new DslModel(categories.OrderBy(x => x.Name));

            foreach (var category in dslModel.Categories)
            {
                category.Parent = dslModel;
            }

            return(dslModel);
        }
示例#2
0
        public static DslModel Build(DocumentModel model)
        {
            Dictionary<string, SummaryComment> summaries;
            var data = GetData(model, out summaries);

            var categories = new List<DslCategory>();
            foreach (var categoryName in data.Keys)
            {
                var metadata = (IDocumentationMetadata)null;

                var categoryMethods = new List<DocumentedMethod>();
                var subCategories = new List<DslSubCategory>();
                foreach (var subCategoryName in data[categoryName].Keys)
                {
                    var methods = data[categoryName][subCategoryName];
                    if (string.IsNullOrWhiteSpace(subCategoryName))
                    {
                        categoryMethods.AddRange(methods.OrderBy(x => x.Identity));
                    }
                    else
                    {
                        subCategories.Add(new DslSubCategory(subCategoryName, methods));
                    }

                    if (metadata == null)
                    {
                        metadata = methods.First().Metadata;
                    }
                }

                SummaryComment summary = null;
                if (summaries.ContainsKey(categoryName))
                {
                    summary = summaries[categoryName];
                }

                categories.Add(
                    new DslCategory(
                        categoryName,
                        metadata,
                        summary,
                        categoryMethods,
                        subCategories.OrderBy(x => x.Name)));
            }

            var dslModel = new DslModel(categories.OrderBy(x => x.Name));
            foreach (var category in dslModel.Categories)
            {
                category.Parent = dslModel;
            }

            return dslModel;
        }
示例#3
0
 public DslController(DslModel model)
 {
     _model = model;
 }
示例#4
0
 public ContentProcessor(IUrlResolver resolver, DslModel dslModel)
 {
     _resolver = resolver;
     _dslModel = dslModel;
 }