다음을 통해 공유


DomainClassXmlSerializer Class

Definition

This is the base class for all generated domain serializers.

public ref class DomainClassXmlSerializer
public class DomainClassXmlSerializer
type DomainClassXmlSerializer = class
Public Class DomainClassXmlSerializer
Inheritance
DomainClassXmlSerializer
Derived

Constructors

DomainClassXmlSerializer()

Constructor

Properties

MonikerAttributeName

Returns the XML attribute name that contains the moniker string. For example, a DomainClass Foo may have MonikerTagName "FooMoniker", and MonikerAttributeName "ref", then a serialized moniker of Foo will look like <FooMoniker ref="foo1" >. An serializer implementation that overrides MonikerTagName should also override MonikerAttributeName. The base implementation returns empty string, meaning that the DomainClass cannot be monikerized.

MonikerTagName

Returns the XML tag name when serializing the handled ModelElement as a moniker. Note that this tag name is different from XmlTagName. This one is for writing a moniker, while XmlTagName is for writing the actual instance of the ModelElement. They need to be different tag names so that the associated schema for the serialized XML is not ambiguous. An serializer implementation that overrides MonikerAttributeName should also override MonikerTagName. The base implementation returns empty string, meaning that the DomainClass cannot be monikerized.

XmlTagName

Returns the XML tag name that will be used in serialization. If a DomainClass cannot be serialized directly (e.g. abstract class, short-form relationship, etc.), emptry string is returned for this property.

Methods

CalculateQualifiedName(DomainXmlSerializerDirectory, ModelElement)

This method calculates a reference to a handled ModelElement instance.

CreateInstance(SerializationContext, XmlReader, Partition)

With the given XmlReader, create an instance of the ModelElement in the given Partition. Note: This method is only called by TryCreateInstance() method once it determines the correct ModelElement instance to create.

CreateMonikerInstance(SerializationContext, XmlReader, ModelElement, Guid, Partition)

With the given XmlReader, create an Moniker instance in the given Store. Note: This method is only called by TryCreateMonikerInstance() method once it determines the correct ModelElement moniker to create.

GetMonikerQualifier(DomainXmlSerializerDirectory, ModelElement)

GetMonikerQualifier returns the long form reference to a model element. The long form reference consists of /Qualifier/short form reference. This method calculates the Qualifier, if it exists.

Read(SerializationContext, ModelElement, XmlReader)

Public Read() method that deserializes the given ModelElement instance from XML.

ReadAdditionalElementData(SerializationContext, ModelElement, XmlReader)

Read any additional element data associated with the element

ReadElements(SerializationContext, ModelElement, XmlReader)

This methods deserializes nested XML elements inside the passed-in element.

ReadPropertiesFromAttributes(SerializationContext, ModelElement, XmlReader)

This method deserializes all properties that are serialized as XML attributes.

ReadRootElement(SerializationContext, ModelElement, XmlReader, ISchemaResolver)

Public ReadRootElement() method that deserializes a root-level element from XML. The difference between root-level element and the rest elements in the XML is that the root may carry additional information like schema, version, etc. The default implementation just calls Read() method, it's up to the derived implementations to do any additional checks.

Reset()

Returns the serializer to its initial state

TryCreateInstance(SerializationContext, XmlReader, Partition)

With the given XmlReader, check if it is currently pointing to a serialized ModelElement instance that this serializer can handle. If so, create an instance of the ModelElement in the given Partition; otherwise return NULL. Note: The caller will guarantee that the reader is positioned at open XML tag of the element being read. This method should not move the reader; the reader should remain at the same position when this method returns.

TryCreateMonikerInstance(SerializationContext, XmlReader, ModelElement, Guid, Partition)

With the given XmlReader, check if it is currently pointing to a monikerized instance of a ModelElement that this serializer can handle. If so, create an Moniker instance in the given Store; otherwise return NULL. Note: The caller will guarantee that the reader is positioned at open XML tag of the element moniker being read. This method will move the reader (unlike TryCreateInstance() method) because it may needs to read the serialized moniker string. If the reader is moved, it should be positioned at the closing tag of the element (so that the caller can call SerializationUtilities.SkipToNextElement() to move to the next element).

Write(SerializationContext, ModelElement, XmlWriter, RootElementSettings)

Public Write() method that serializes the ModelElement instance associated with this serializer instance into XML.

Write(SerializationContext, ModelElement, XmlWriter)

Public Write() method that serializes the ModelElement instance associated with this serializer instance into XML. This method just calls Write() with no RootElementSettings.

WriteAdditionalElementData(SerializationContext, ModelElement, XmlWriter)

Write any additional element data associated with the element

WriteElements(SerializationContext, ModelElement, XmlWriter)

This methods serializes 1) properties serialized as nested XML elements and 2) child model elements into XML.

WriteMoniker(SerializationContext, ModelElement, XmlWriter, ModelElement, DomainRelationshipXmlSerializer)

Public WriteMoniker() method that writes a monikerized ModelElement instance into XML.

WritePropertiesAsAttributes(SerializationContext, ModelElement, XmlWriter)

Write all properties that need to be serialized as XML attributes.

WriteRootElement(SerializationContext, ModelElement, XmlWriter)

Public WriteRootElement() method that serializes a root-level element to XML. The difference between root-level element and the rest elements in the XML is that the root may carry additional information like schema, version, etc. The default implementation just calls Write() method with no RootElementSettings, it's up to the derived implementations to do any additional checks.

Applies to