Table of Contents

Class ExtensionBasedSerializer

Namespace
NMF.Models.Repository
Assembly
NMF.Models.dll

Denotes a model serializer that chooses the actual serialization process based on the file extension

public class ExtensionBasedSerializer : IModelSerializer, IEnumerable<KeyValuePair<string, IModelSerializer>>, IEnumerable
Inheritance
ExtensionBasedSerializer
Implements
Inherited Members
Extension Methods

Constructors

ExtensionBasedSerializer()

Create a new instance

public ExtensionBasedSerializer()

ExtensionBasedSerializer(IModelSerializer)

Create a new instance

public ExtensionBasedSerializer(IModelSerializer defaultSerializer)

Parameters

defaultSerializer IModelSerializer

the default serializer

ExtensionBasedSerializer(IModelSerializer, Dictionary<string, IModelSerializer>)

Create a new instance

public ExtensionBasedSerializer(IModelSerializer defaultSerializer, Dictionary<string, IModelSerializer> serializerByExtension)

Parameters

defaultSerializer IModelSerializer

the default serializer

serializerByExtension Dictionary<string, IModelSerializer>

Methods

Add(string, IModelSerializer)

Registers the given serializer for the given extension

public void Add(string extension, IModelSerializer serializer)

Parameters

extension string

the extension (including the leading period)

serializer IModelSerializer

the serializer

Deserialize(Stream, Uri, IModelRepository, bool)

Deserializes the given source into a model

public Model Deserialize(Stream source, Uri modelUri, IModelRepository repository, bool addToRepository)

Parameters

source Stream

the source stream

modelUri Uri

the URI of the model

repository IModelRepository

the repository in the context of which the model is deserialized

addToRepository bool

true, if the model should be added to the repository, otherwise false

Returns

Model

the deserialized model

GetEnumerator()

Returns an enumerator that iterates through the collection.

public IEnumerator<KeyValuePair<string, IModelSerializer>> GetEnumerator()

Returns

IEnumerator<KeyValuePair<string, IModelSerializer>>

An enumerator that can be used to iterate through the collection.

Serialize(Model, Stream)

Serializes the given model to the given target stream

public void Serialize(Model model, Stream target)

Parameters

model Model

the model to serialize

target Stream

the target stream

SerializeFragment(ModelElement, Stream)

Serialize the given model element as a fragment to the given stream

public void SerializeFragment(ModelElement element, Stream target)

Parameters

element ModelElement

the model element to serialize

target Stream

the target stream