Exemple #1
0
        private void ResolveAssociation(XmlReader reader, MetadataConceptContainer container)
        {
            //创建关系元素对象
            var association = new MetadataAssociation(reader.GetAttribute(XML_NAME_ATTRIBUTE));

            int depth = reader.Depth;

            while (reader.Read() && reader.Depth > depth)
            {
                if (reader.NodeType != XmlNodeType.Element)
                {
                    continue;
                }

                if (reader.Name == XML_END_ELEMENT)
                {
                    var member = new MetadataAssociationEnd(reader.GetAttribute(XML_NAME_ATTRIBUTE), reader.GetAttribute(XML_ENTITY_ATTRIBUTE))
                    {
                        Multiplicity = this.GetAttributeValue <MetadataAssociationMultiplicity>(reader, XML_MULTIPLICITY_ATTRIBUTE, MetadataAssociationMultiplicity.One),
                    };

                    //解析当前关系顶点的内部元素
                    this.ResolveAssociationEnd(reader, member);

                    //将解析成功的命令参数元素加入到命令的参数集合
                    association.Members.Add(member);
                }
                else
                {
                    this.ProcessUnrecognizedElement(reader, null, container);
                }
            }

            container.Associations.Add(association);
        }
Exemple #2
0
        private void ResolveContainer(XmlReader reader, MetadataFile file)
        {
            if (reader.ReadState == ReadState.Initial)
            {
                reader.Read();
            }

            if (reader.NodeType != XmlNodeType.Element)
            {
                throw new InvalidOperationException("The reader position is invalid.");
            }

            switch (reader.NamespaceURI.ToLowerInvariant())
            {
            case XML_STORAGE_NAMESPACE_URI:
                var storageContainer = new MetadataStorageContainer(reader.GetAttribute(XML_NAME_ATTRIBUTE), reader.GetAttribute("provider"), file);
                file.Storages.Add(storageContainer);

                using (reader = reader.ReadSubtree())
                {
                    this.ResolveContainer(reader, storageContainer);
                }

                break;

            case XML_CONCEPT_NAMESPACE_URI:
                var conceptContainer = new MetadataConceptContainer(reader.GetAttribute(XML_NAME_ATTRIBUTE), file);
                file.Concepts.Add(conceptContainer);

                using (reader = reader.ReadSubtree())
                {
                    this.ResolveContainer(reader, conceptContainer);
                }

                break;

            default:
                using (reader = reader.ReadSubtree())
                {
                    this.ProcessUnrecognizedElement(reader, file, null);
                }

                break;
            }
        }
Exemple #3
0
 public MetadataAssociationCollection(MetadataConceptContainer container) : base(container)
 {
 }
 public MetadataConceptEntityCollection(MetadataConceptContainer container) : base(container)
 {
 }