Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1690
IProvideCustomObjectPersistence
posted

Hello,

i believe that is a great feature of Persistence Framework...

Why do you have it undocumented?

Also when and how the IProvideCustomtPersistence interface is used?

Regards,

Michael

  • 27093
    Verified Answer
    posted

    Hello Michael,

    I am just checking the progress of this issue and was wondering if you managed to achieve your goal or if you need any further assistance on the matter.

    If the above suggestion helped you solve your issue please verify the thread as answered so other users may take better advantage of it.

  • 27093
    posted

    Hello,

     

    I got an explanation I our development team for using the interface.

     

    I would say that the main functionality of this interface is to allow an object to be serialized and desterilized into a string. 

     

    So if you have an object that you want persisted you would implement this interface on the object.  Then when the PerMgr is running on the object, it will see that the interface is on the object and call the .Save method and you would take the object and make a string that will represent your object.  The Load method takes your string and allows you to rehydrate.

     

    So in the example in the class above  when we save the SortedColumnsCollection, we really just want to know what columns and what direction those column are in.

    So our save method looks like

     

    string val = "";

          

    foreach (Column col in this)

    {

        val += col.Key + ":" + col.IsSorted + ",";

    }

    return val;

     

     

    In load we have

     

    protected virtual void Load(object owner, string value)

    {

        if (value != null)

        {

            SortingSettingsOverride settings = owner as SortingSettingsOverride;

            if (settings != null && settings.ColumnLayout != null)

            {

                this.Clear();

                string[] cols = ((string)value).Split(',');

                foreach (string col in cols)

                {

                    if (col.Length > 0)

                    {

                        string[] keyPair = col.Split(':');

                        if (keyPair.Length == 2)

                        {

                            Column column = settings.ColumnLayout.Columns.DataColumns[keyPair[0]];

                            if (column != null)

                            {

                                column.IsSorted = (SortDirection)Enum.Parse(typeof(SortDirection), keyPair[1], true);

                            }

                        }

                    }

                }

            }

        }

    }

     

    So we get the string that we persisted in the value property, since we know what object we are in we take the string , parse it and rehydrate our object.

     

    I can also suggest you look through the source code to get a better understanding of the approach.

     

    Please let me know if I can assist you further on the matter.

  • 27093
    posted

    Hello Michael,

     

    I have been looking into you issue and I do see what you mean. I am going to contact our Documentations and Product Guidance departments on your behalf and see if the y can come up with anything suitable.

     

    I’ll update you shortly on my progress.