コード例 #1
0
        /// <summary>
        /// Retrieves personalization state as opaque blobs from the data source.
        /// </summary>
        /// <param name="webPartManager">The web part manager.</param>
        /// <param name="path">The path indicating where to save the data.</param>
        /// <param name="userName">The user name.</param>
        /// <param name="sharedDataBlob">A byte array containing the user shared data to loaded.</param>
        /// <param name="userDataBlob">A byte array containing the user data to be loaded.</param>
        /// <remarks>Retrieves both shared and user personalization state corresponding to a specified user and a specified page.</remarks>
        protected override void LoadPersonalizationBlobs(WebPartManager webPartManager, string path, string userName, ref Byte[] sharedDataBlob, ref Byte[] userDataBlob)
        {
            sharedDataBlob = null;
            userDataBlob   = null;
            MySQLPersonalizationConnectionHelper connection = new MySQLPersonalizationConnectionHelper(connectionString);

            connection.OpenConnection(true);
            try
            {
                sharedDataBlob = PersonalizationProviderProcedures.my_aspnet_PersonalizationAllUsers_GetPageSettings(
                    ApplicationId, path, connection);
                if (!String.IsNullOrEmpty(userName))
                {
                    userDataBlob = PersonalizationProviderProcedures.my_aspnet_PersonalizationPerUser_GetPageSettings(
                        ApplicationId, path, userName, DateTime.UtcNow, connection);
                }

                connection.CloseConnection();
            }
            catch (Exception ex)
            {
                if (writeExceptionsToEventLog)
                {
                    WriteToEventLog(ex, "MySQLPersonalizationProvider - LoadPersonazalitionBlobs");
                }
                throw;
            }
            finally
            {
                connection.CloseConnection();
            }
        }