コード例 #1
0
ファイル: ClassBuilder.cs プロジェクト: kzu/dotnetopensrc
        public override void Visit(VisitableSchemaRoot element)
        {
            OnProgress("Building classes ...");
            base.Visit(element);

            if (CurrentNamespace == null)
            {
                CurrentNamespace = new CodeNamespace(element.SchemaObject.TargetNamespace);
                CurrentNamespace.Imports.AddRange(CodeDomHelper.BuildNamespaceImports(Configuration.NamespaceImports));
                // Append unhandled attributes to the type UserData property, for use by custom visitors.
                XmlAttribute[] attributes = element.SchemaObject.UnhandledAttributes;
                if (attributes != null)
                {
                    foreach (XmlAttribute attr in attributes)
                    {
                        CurrentNamespace.UserData.Add(attr.LocalName, attr);
                    }
                }

                Unit.Namespaces.Add(CurrentNamespace);
            }
        }