Beispiel #1
0
        private static UnionTypeDefinitionNode AddTypes(
            UnionTypeDefinitionNode typeDefinition,
            UnionTypeExtensionNode typeExtension)
        {
            if (typeExtension.Types.Count == 0)
            {
                return(typeDefinition);
            }

            var types = new OrderedDictionary <string, NamedTypeNode>();

            foreach (NamedTypeNode type in typeDefinition.Types)
            {
                types[type.Name.Value] = type;
            }

            foreach (NamedTypeNode type in typeExtension.Types)
            {
                types[type.Name.Value] = type;
            }

            return(typeDefinition.WithTypes(types.Values.ToList()));
        }