/// <summary> /// Saves raw personalization data to the underlying data store. /// </summary> /// <param name="webPartManager">The WebPartManager managing the personalization data.</param> /// <param name="path">The path for personalization information to be used as the data store key.</param> /// <param name="userName">The user name for personalization information to be used as the key.</param> /// <param name="dataBlob">The byte array of data to be saved.</param> protected override void SavePersonalizationBlob(System.Web.UI.WebControls.WebParts.WebPartManager webPartManager, string path, string userName, byte[] dataBlob) { if (userName == null) { SharedPersonalization sharedPersonalization = SharedPersonalizationDataSource.LoadForPath(path, true); sharedPersonalization.PageSettings = dataBlob; sharedPersonalization.Save(); } else { UserPersonalization userPersonalization = UserPersonalizationDataSource.LoadForPath(path, userName, true); userPersonalization.PageSettings = dataBlob; userPersonalization.Save(); } }
/// <summary> /// Loads raw personalization data from the underlying data store. /// </summary> /// <param name="webPartManager">The WebPartManager managing the personalization data.</param> /// <param name="path">The path for personalization information to be used as the retrieval key.</param> /// <param name="userName">The user name for personalization information to be used as the retrieval key.</param> /// <param name="sharedDataBlob">The returned data for the Shared scope.</param> /// <param name="userDataBlob">The returned data for the User scope.</param> protected override void LoadPersonalizationBlobs(System.Web.UI.WebControls.WebParts.WebPartManager webPartManager, string path, string userName, ref byte[] sharedDataBlob, ref byte[] userDataBlob) { sharedDataBlob = null; userDataBlob = null; SharedPersonalization sharedPersonalization = SharedPersonalizationDataSource.LoadForPath(path, false); if (sharedPersonalization != null) { sharedDataBlob = sharedPersonalization.PageSettings; } UserPersonalization UserPersonalization = UserPersonalizationDataSource.LoadForPath(path, userName, false); if (UserPersonalization != null) { userDataBlob = UserPersonalization.PageSettings; } }
/// <summary> /// Deletes raw personalization data from the underlying data store. /// </summary> /// <param name="webPartManager">The WebPartManager managing the personalization data.</param> /// <param name="path">The path for personalization information to be used as the data store key.</param> /// <param name="userName">The user name for personalization information to be used as the data store key.</param> protected override void ResetPersonalizationBlob(System.Web.UI.WebControls.WebParts.WebPartManager webPartManager, string path, string userName) { if (string.IsNullOrEmpty(userName)) { SharedPersonalization sharedPersonalization = SharedPersonalizationDataSource.LoadForPath(path, false); if (sharedPersonalization != null) { sharedPersonalization.Delete(); } } else { UserPersonalization userPersonalization = UserPersonalizationDataSource.LoadForPath(path, userName, false); if (userPersonalization != null) { userPersonalization.Delete(); } } }