Exemplo n.º 1
0
        public void Import(XmlDocument metadataXmlDocument)
        {
            using (_transaction.EnterNonDiscardingScope())
            {
                SecurityMetadataSchema metadataSchema = new SecurityMetadataSchema();
                if (!metadataXmlDocument.Schemas.Contains(metadataSchema.SchemaUri))
                {
                    metadataXmlDocument.Schemas.Add(metadataSchema.LoadSchemaSet());
                }

                metadataXmlDocument.Validate(null);

                XmlNamespaceManager namespaceManager = new XmlNamespaceManager(metadataXmlDocument.NameTable);
                namespaceManager.AddNamespace("md", metadataSchema.SchemaUri);

                AddItem(_classes, metadataXmlDocument, "/md:securityMetadata/md:classes/md:class", namespaceManager, CreateSecurableClassDefinition);
                AddItem(
                    _stateProperties,
                    metadataXmlDocument,
                    "/md:securityMetadata/md:stateProperties/md:stateProperty",
                    namespaceManager,
                    CreateStatePropertyDefinition);
                AddItem(
                    _abstractRoles,
                    metadataXmlDocument,
                    "/md:securityMetadata/md:abstractRoles/md:abstractRole",
                    namespaceManager,
                    CreateAbstractRoleDefinition);
                AddItem(_accessTypes, metadataXmlDocument, "/md:securityMetadata/md:accessTypes/md:accessType", namespaceManager, CreateAccessTypeDefinition);

                LinkDerivedClasses();
                LinkStatePropertiesToClasses();
                LinkAccessTypesToClasses();
            }
        }
 public MetadataToXmlConverter()
 {
     _metadataSchema = new SecurityMetadataSchema();
 }