Skip to main content

ITpPersistence

This interface specifies endpoints for save and restore data.

It's something optional and a bit low-level. But it's an easy way to save and restore TPT tile's instance data of your choosing.

public interface ITpPersistence<out TR, in T> : ITpPersistenceBase              
      where T:MessagePacket<T> where TR:MessagePacket<TR>                         
   {                                                                            
        /// <summary>                                                           
        /// Implement to provide data to save                                   
        /// </summary>                                                          
        /// <returns>TR.</returns>                                              
        TR GetSaveData(object options = null);                                  
                                                                                
        /// <summary>                                                           
        /// Implement to be sent data to restore                                
        /// </summary>                                                          
        /// <param name="dataToRestore">The data to restore.</param>            
        void RestoreSaveData(T dataToRestore);                                  
                                                                                
        /// <summary>                                                           
        /// Implementations may set this false if either                        
        /// data has already been restored OR if it doesn't                     
        /// want data restoration at all.                                       
        /// New in 3.1                                                          
        /// </summary>                                                          
        bool AllowsRestore { get; }                                             
                                                                                
        /// <summary>                                                           
        /// Implementations may set this false if                               
        /// nothing has changed in the tile.                                    
        /// That avoids saving data from this tile if nothing                   
        /// has changed since instantiaton.                                     
        /// Default is true;                                                    
        /// New in 3.1                                                          
        /// </summary>                                                          
        bool AllowsSave => true;                                                
                                                                                
   }                                                                            

There's a chapter on Persistence here.