locked
How to extend auto-generated IsolatedStorageOfflineEntity class with additional, non-synced properties? RRS feed

  • Question

  • Hi,

    I am new to the Sync Framework and beeing currently playing with the Windows Phone 7 sample of the current Sync Framework Toolkit. I need a synchronisation between Windows Phone 7 devices and a SQL Server/SQL Azure database.

    The sample provided in the toolkit works fine, but I was wondering how I could extend the auto-generated classes, which derives from IsolatedStorageOfflineEntity, with additional, non-synced properties which are also persistet? I need these additional properties for local storage and I would like to use the Sync Framework persistence to avoid a second persistence mechanism.

    I have this auto-generated class:

    public partial class List : Microsoft.Synchronization.ClientServices.IsolatedStorage.IsolatedStorageOfflineEntity {
           
            private System.Guid _ID;       
            private string _Name;
           
            [System.ComponentModel.DataAnnotations.KeyAttribute()]
            public System.Guid ID {
                get {
                    return _ID;
                }
                set {
                    base.OnPropertyChanging("ID");
                    _ID = value;
                    base.OnPropertyChanged("ID");
                }
            }
           
            public string Name {
                get {
                    return _Name;
                }
                set {
                    base.OnPropertyChanging("Name");
                    _Name = value;
                    base.OnPropertyChanged("Name");
                }
            }
    }

     

    I tried to extend the auto-generated class via a partial class:

    public partial class List
        {
            private string _testString;

            public string TestString
            {
                get
                {
                    return _testString;
                }
                set
                {
                    base.OnPropertyChanging("TestString");
                    _testString = value;
                    base.OnPropertyChanged("TestString");
                }
            }
        }

     

    I made some tests and observed that I can use my addtional property, but it is not persited!!!

    Can someone explain me how the persistence works and what is the recommended way for my scenario?

    Thanks in advance!

    Bye,
    Sebastian


    • Edited by we_develop Saturday, January 7, 2012 8:55 AM
    Saturday, January 7, 2012 8:42 AM

All replies