static SqlDependencyInfo[] ParseSqlDependencyString(string sqlDependencyString)
        {
            // The code for this method was taken from private code in
            // System.Web.SqlCacheDependency.ParseSql7OutputCacheDependency.
            // Alter if only absolutely necessary since we want to reproduce the same ASP.NET caching behavior.

            List <SqlDependencyInfo> dependencyList = new List <SqlDependencyInfo>();
            bool   escapeSequenceFlag        = false;
            int    startIndexForDatabaseName = 0;
            int    startIndexForTableName    = -1;
            string databaseName = null;

            try
            {
                for (int currentIndex = 0; currentIndex < (sqlDependencyString.Length + 1); currentIndex++)
                {
                    if (escapeSequenceFlag)
                    {
                        escapeSequenceFlag = false;
                    }
                    else if ((currentIndex != sqlDependencyString.Length) &&
                             (sqlDependencyString[currentIndex] == escapeChar))
                    {
                        escapeSequenceFlag = true;
                    }
                    else
                    {
                        int subStringLength;
                        if ((currentIndex == sqlDependencyString.Length) ||
                            (sqlDependencyString[currentIndex] == seperatorChar))
                        {
                            if (databaseName == null)
                            {
                                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument(invalidSqlDependencyString);
                            }
                            subStringLength = currentIndex - startIndexForTableName;
                            if (subStringLength == 0)
                            {
                                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument(invalidSqlDependencyString);
                            }
                            string            tableName = sqlDependencyString.Substring(startIndexForTableName, subStringLength);
                            SqlDependencyInfo info      = new SqlDependencyInfo();
                            info.Database = VerifyAndRemoveEscapeCharacters(databaseName);
                            info.Table    = VerifyAndRemoveEscapeCharacters(tableName);
                            dependencyList.Add(info);
                            startIndexForDatabaseName = currentIndex + 1;
                            databaseName = null;
                        }
                        if (currentIndex == sqlDependencyString.Length)
                        {
                            break;
                        }
                        if (sqlDependencyString[currentIndex] == tableDbSeperatorChar)
                        {
                            if (databaseName != null)
                            {
                                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument(invalidSqlDependencyString);
                            }
                            subStringLength = currentIndex - startIndexForDatabaseName;
                            if (subStringLength == 0)
                            {
                                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument(invalidSqlDependencyString);
                            }
                            databaseName           = sqlDependencyString.Substring(startIndexForDatabaseName, subStringLength);
                            startIndexForTableName = currentIndex + 1;
                        }
                    }
                }
            }
            catch (ArgumentException)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(SR2.GetString(SR2.CacheProfileSqlDependencyIsInvalid, sqlDependencyString)));
            }
            if (dependencyList.Count == 0)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(SR2.GetString(SR2.CacheProfileSqlDependencyIsInvalid, sqlDependencyString)));
            }
            return(dependencyList.ToArray());
        }
        static SqlDependencyInfo[] ParseSqlDependencyString(string sqlDependencyString)
        {
            // The code for this method was taken from private code in 
            // System.Web.SqlCacheDependency.ParseSql7OutputCacheDependency.
            // Alter if only absolutely necessary since we want to reproduce the same ASP.NET caching behavior.

            List<SqlDependencyInfo> dependencyList = new List<SqlDependencyInfo>();
            bool escapeSequenceFlag = false;
            int startIndexForDatabaseName = 0;
            int startIndexForTableName = -1;
            string databaseName = null;

            try
            {
                for (int currentIndex = 0; currentIndex < (sqlDependencyString.Length + 1); currentIndex++)
                {
                    if (escapeSequenceFlag)
                    {
                        escapeSequenceFlag = false;
                    }
                    else if ((currentIndex != sqlDependencyString.Length) &&
                             (sqlDependencyString[currentIndex] == escapeChar))
                    {
                        escapeSequenceFlag = true;
                    }
                    else
                    {
                        int subStringLength;
                        if ((currentIndex == sqlDependencyString.Length) ||
                            (sqlDependencyString[currentIndex] == seperatorChar))
                        {
                            if (databaseName == null)
                            {
                                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument(invalidSqlDependencyString);
                            }
                            subStringLength = currentIndex - startIndexForTableName;
                            if (subStringLength == 0)
                            {
                                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument(invalidSqlDependencyString);
                            }
                            string tableName = sqlDependencyString.Substring(startIndexForTableName, subStringLength);
                            SqlDependencyInfo info = new SqlDependencyInfo();
                            info.Database = VerifyAndRemoveEscapeCharacters(databaseName);
                            info.Table = VerifyAndRemoveEscapeCharacters(tableName);
                            dependencyList.Add(info);
                            startIndexForDatabaseName = currentIndex + 1;
                            databaseName = null;
                        }
                        if (currentIndex == sqlDependencyString.Length)
                        {
                            break;
                        }
                        if (sqlDependencyString[currentIndex] == tableDbSeperatorChar)
                        {
                            if (databaseName != null)
                            {
                                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument(invalidSqlDependencyString);
                            }
                            subStringLength = currentIndex - startIndexForDatabaseName;
                            if (subStringLength == 0)
                            {
                                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument(invalidSqlDependencyString);
                            }
                            databaseName = sqlDependencyString.Substring(startIndexForDatabaseName, subStringLength);
                            startIndexForTableName = currentIndex + 1;
                        }
                    }
                }
            }
            catch (ArgumentException)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(SR2.GetString(SR2.CacheProfileSqlDependencyIsInvalid, sqlDependencyString)));
            }
            if (dependencyList.Count == 0)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(SR2.GetString(SR2.CacheProfileSqlDependencyIsInvalid, sqlDependencyString)));
            }
            return dependencyList.ToArray();
        }