private StringBuilder CreateRawCacheKey()
        {
            // Note: The cache key will contain information such as server names and
            // passwords, however it will be stored in the internal cache, which is
            // not accessible to page developers, so it is secure.
            StringBuilder sb = new StringBuilder(CacheInternal.PrefixDataSourceControl, 1024);

            sb.Append(GetType().GetHashCode().ToString(CultureInfo.InvariantCulture));

            sb.Append(CacheDuration.ToString(CultureInfo.InvariantCulture));
            sb.Append(':');
            sb.Append(((int)CacheExpirationPolicy).ToString(CultureInfo.InvariantCulture));

            SqlDataSourceCache sqlCache = Cache as SqlDataSourceCache;

            if (sqlCache != null)
            {
                sb.Append(":");
                sb.Append(sqlCache.SqlCacheDependency);
            }

            sb.Append(":");
            sb.Append(ConnectionString);
            sb.Append(":");
            sb.Append(SelectCommand);
            //sb.Append(SelectCountCommand);

            // Append parameter names and values
            if (SelectParameters.Count > 0)
            {
                sb.Append("?");
                IDictionary parameters = SelectParameters.GetValues(Context, this);
                foreach (DictionaryEntry entry in parameters)
                {
                    sb.Append(entry.Key.ToString());
                    if ((entry.Value != null) && (entry.Value != DBNull.Value))
                    {
                        sb.Append("=");
                        sb.Append(entry.Value.ToString());
                    }
                    else
                    {
                        if (entry.Value == DBNull.Value)
                        {
                            sb.Append("(dbnull)");
                        }
                        else
                        {
                            sb.Append("(null)");
                        }
                    }
                    sb.Append("&");
                }
            }
            return(sb);
        }
        internal string CreateCacheKey()
        {
            StringBuilder sb = new StringBuilder(CacheInternal.PrefixDataSourceControl, 1024);

            sb.Append(GetType().GetHashCode().ToString(CultureInfo.InvariantCulture));

            sb.Append(CacheDuration.ToString(CultureInfo.InvariantCulture));
            sb.Append(':');
            sb.Append(((int)CacheExpirationPolicy).ToString(CultureInfo.InvariantCulture));

            bool includeUniqueID = false;

            if (!String.IsNullOrEmpty(CacheKeyContext))
            {
                sb.Append(':');
                sb.Append(CacheKeyContext);
            }

            if (DataFile.Length > 0)
            {
                sb.Append(':');
                sb.Append(DataFile);
            }
            else
            {
                if (Data.Length > 0)
                {
                    includeUniqueID = true;
                }
            }

            if (TransformFile.Length > 0)
            {
                sb.Append(':');
                sb.Append(TransformFile);
            }
            else
            {
                if (Transform.Length > 0)
                {
                    includeUniqueID = true;
                }
            }

            if (includeUniqueID)
            {
                // If we don't have any paths, use the Page
                if (Page != null)
                {
                    sb.Append(':');
                    sb.Append(Page.GetType().AssemblyQualifiedName);
                }
                sb.Append(':');
                string uniqueID = UniqueID;
                if (String.IsNullOrEmpty(uniqueID))
                {
                    throw new InvalidOperationException(SR.GetString(SR.XmlDataSource_NeedUniqueIDForCache));
                }
                sb.Append(uniqueID);
            }

            return(sb.ToString());
        }