Ejemplo n.º 1
0
            private static DocumentNode MergeSchemas(
                StitchingBuilder builder,
                IDictionary <NameString, DocumentNode> schemas)
            {
                var merger = new SchemaMerger();

                foreach (NameString name in schemas.Keys)
                {
                    merger.AddSchema(name, schemas[name]);
                }

                foreach (MergeTypeRuleFactory handler in builder._mergeRules)
                {
                    merger.AddMergeRule(handler);
                }

                foreach (IDocumentRewriter rewriter in builder._docRewriters)
                {
                    merger.AddDocumentRewriter(rewriter);
                }

                foreach (ITypeRewriter rewriter in builder._typeRewriters)
                {
                    merger.AddTypeRewriter(rewriter);
                }

                return(merger.Merge());
            }
        private static DocumentNode MergeSchemas(
            IDescriptorContext context,
            IDictionary <NameString, DocumentNode> schemas)
        {
            var merger = new SchemaMerger();

            foreach (NameString name in schemas.Keys)
            {
                merger.AddSchema(name, schemas[name]);
            }

            foreach (MergeTypeRuleFactory handler in context.GetTypeMergeRules())
            {
                merger.AddTypeMergeRule(handler);
            }

            foreach (MergeDirectiveRuleFactory handler in context.GetDirectiveMergeRules())
            {
                merger.AddDirectiveMergeRule(handler);
            }

            foreach (IDocumentRewriter rewriter in context.GetDocumentRewriter())
            {
                merger.AddDocumentRewriter(rewriter);
            }

            foreach (ITypeRewriter rewriter in context.GetTypeRewriter())
            {
                merger.AddTypeRewriter(rewriter);
            }

            return(merger.Merge());
        }