Esempio n. 1
0
        protected override void ImportPartsBySchemaElement(QName qname, List <MessagePartDescription> parts, Message msg, MessagePart msgPart)
        {
            if (schema_set_cache != schema_set_in_use)
            {
                schema_set_cache = schema_set_in_use;
                var xss = new XmlSchemas();
                foreach (XmlSchema xs in schema_set_cache.Schemas())
                {
                    xss.Add(xs);
                }
                schema_importer = new XmlSchemaImporter(xss);
                if (ccu.Namespaces.Count == 0)
                {
                    ccu.Namespaces.Add(new CodeNamespace());
                }
                var cns = ccu.Namespaces [0];
                code_exporter = new XmlCodeExporter(cns, ccu);
            }

            var part = new MessagePartDescription(qname.Name, qname.Namespace);

            part.XmlSerializationImporter = this;
            var mbrNS = msg.ServiceDescription.TargetNamespace;
            var xmm   = schema_importer.ImportMembersMapping(qname);

            code_exporter.ExportMembersMapping(xmm);
            // FIXME: use of ElementName is a hack!
            part.CodeTypeReference = new CodeTypeReference(xmm.ElementName);
            parts.Add(part);
            Console.Error.WriteLine("CodeNamespace {1} in CCU {2} now contains {0} types.", ccu.Namespaces [0].Types.Count, ccu.Namespaces [0].GetHashCode(), ccu.GetHashCode());
        }