Search
IPersists Interface
Remarks See Also
 





Base interface for serializable MindFusion.Diagramming objects.

Namespace: MindFusion.Diagramming
Assembly: MindFusion.Diagramming

 Syntax

C#  Copy Code

public interface IPersists

Visual Basic  Copy Code

Public Interface IPersists

 Remarks

Serializable MindFusion.Diagramming classes implement explicitly this interface to hide it from the public. Explicit implementation however has the restrictions that the implemented methods are private and non-polymorphic. To avoid these limitations each implementing class provides another set of methods corresponding to the IPersists methods, which are declared as internal and retain polymorphism.

 Example

The following sample class illustrates this technique:

C#  Copy Code

class PersistingItem : IPersists
{
    int IPersists.GetClassId()
    {
        return GetClassIdInternal();
    }

    void IPersists.SaveTo(BinaryWriter writer, PersistContext ctx)
    {
        SaveToInternal(writer, ctx);
    }

    void IPersists.LoadFrom(BinaryReader reader, PersistContext ctx)
    {
        LoadFromInternal(reader, ctx);
    }

    void IPersists.SetReference(int refId, object obj)
    {
        SetReferenceInternal(refId, obj);
    }

    internal virtual int GetClassId()
    {
        return ClassId;
    }

    internal virtual void SaveTo(BinaryWriter writer, PersistContext ctx)
    {
    }

    internal virtual void LoadFrom(BinaryReader reader, PersistContext ctx)
    {
    }

    internal virtual void SetReference(int refId, object obj)
    {
    }
}

 Inheritors

 See Also