src/Shared/EntityFramework/Core/Common/QueryCache/EntityClientCacheKey.cs
// <summary>
// Returns a string representation of the parameter list
// </summary>
Returns a string representation of the parameter list
Returns a string representation of the parameter list
private static string GetParametersToken(EntityCommand entityCommand)
        {
            if (null == entityCommand.Parameters
                || 0 == entityCommand.Parameters.Count)
            {
                 means no parameters
                return "@@0";
            }
             Ensure that parameter DbTypes are valid and there are no duplicate names
            var paramTypeUsage = entityCommand.GetParameterTypeUsage();
            Debug.Assert(
                paramTypeUsage.Count == entityCommand.Parameters.Count,
                "entityParameter collection and query parameter collection must have the same number of entries");
            if (1 == paramTypeUsage.Count)
            {
                 if its one parameter only, there is no need to use stringbuilder
                return "@@1:" +
                       entityCommand.Parameters[0].ParameterName + ":" +
                       GetTypeUsageToken(paramTypeUsage[entityCommand.Parameters[0].ParameterName]);
            }
            else
            {
                var sb = new StringBuilder(entityCommand.Parameters.Count * EstimatedParameterStringSize);
                Debug.Assert(
                    paramTypeUsage.Count == entityCommand.Parameters.Count,
                    "entityParameter collection and query parameter collection must have the same number of entries");
                sb.Append("@@");
                sb.Append(entityCommand.Parameters.Count);
                sb.Append(":");
                var separator = "";
                foreach (var param in paramTypeUsage)
                {
                    sb.Append(separator);
                    sb.Append(param.Key);
                    sb.Append(":");
                    sb.Append(GetTypeUsageToken(param.Value));
                    separator = ";";
                }
                return sb.ToString();
            }
        }
private static string GetParametersToken ( EntityCommand entityCommand ) { if ( null == entityCommand . Parameters || 0 == entityCommand . Parameters . Count ) { return " " ; } var paramTypeUsage = entityCommand . GetParameterTypeUsage ( ) ; Debug . Assert ( paramTypeUsage . Count == entityCommand . Parameters . Count , " " ) ; if ( 1 == paramTypeUsage . Count ) { return " " + entityCommand . Parameters [ 0 ] . ParameterName + " " + GetTypeUsageToken ( paramTypeUsage [ entityCommand . Parameters [ 0 ] . ParameterName ] ) ; } else { var sb = new StringBuilder ( entityCommand . Parameters . Count * EstimatedParameterStringSize ) ; Debug . Assert ( paramTypeUsage . Count == entityCommand . Parameters . Count , " " ) ; sb . Append ( " " ) ; sb . Append ( entityCommand . Parameters . Count ) ; sb . Append ( " " ) ; var separator = " " ; foreach ( var param in paramTypeUsage ) { sb . Append ( separator ) ; sb . Append ( param . Key ) ; sb . Append ( " " ) ; sb . Append ( GetTypeUsageToken ( param . Value ) ) ; separator = " " ; } return sb . ToString ( ) ; } }
Returns a string representation of the parameter list
Returns a string representation of the parameter list
// // means no parameters // // Ensure that parameter DbTypes are valid and there are no duplicate names // if its one parameter only, there is no need to use stringbuilder
entityCommand
EntityCommand