views:

58

answers:

0

I have a class, which is defined as the following:

[ToolboxItem(false)]
[DesignTimeVisible(false)]
[DesignerSerializer("DevExpress.XtraEditors.Design.RepositoryItemCodeDomSerializer, DevExpress.XtraEditors.v10.1.Design", "System.ComponentModel.Design.Serialization.CodeDomSerializer, System.Design")]
[Designer("DevExpress.XtraEditors.Design.BaseRepositoryItemDesigner, DevExpress.XtraEditors.v10.1.Design")]
[LicenseProvider(typeof(DXEditorLicenseProvider))]
public class RepositoryItem : Component, ISupportInitialize, ICustomTypeDescriptor, IImageCollectionHelper
{......}

I tried the following code to serialize the object of this class.

        DesignerSerializationManager m = new System.ComponentModel.Design.Serialization.DesignerSerializationManager();
        m.CreateSession();

        CodeDomSerializer s = m.GetSerializer(typeof(RepositoryItem), typeof(CodeDomSerializer)) as CodeDomSerializer;

        RepositoryItem i = persistentRepository1.Items[0];
        //m.Container.Add(i);

        s.Serialize(m,i ); // What's the next?

For I am not familiar with CodeDom, I have spent one day to get the way out. Please give me a hand to show how to finish the work of serializing AND DeSelializing such objects of the class of Repository.

BTW, the reason I don't use any other serializer is that I am supposed not to have rights to know the source code of RepositoryItem and others could inherit RepositoryItem at the same time. And actually I have to deal with RepositoryItem and its descendants.

Thank you in advance.

Ying