public static string ToDebugString( [NotNull] this ISqlQuery sqlQuery, MetadataDebugStringOptions options, int indent = 0) { var builder = new StringBuilder(); var indentString = new string(' ', indent); builder .Append(indentString) .Append("SqlQuery: "); if (sqlQuery.Schema != null) { builder .Append(sqlQuery.Schema) .Append("."); } builder.Append(sqlQuery.Name); if ((options & MetadataDebugStringOptions.SingleLine) == 0) { if (sqlQuery.Sql != null) { builder.AppendLine().Append(indentString).Append(" Sql: "); builder.AppendLine().Append(indentString).Append(new string(' ', 4)).Append(sqlQuery.Sql); } var mappings = sqlQuery.EntityTypeMappings.ToList(); if (mappings.Count != 0) { builder.AppendLine().Append(indentString).Append(" EntityTypeMappings: "); foreach (var mapping in mappings) { builder.AppendLine().Append(mapping.ToDebugString(options, indent + 4)); } } var columns = sqlQuery.Columns.ToList(); if (columns.Count != 0) { builder.AppendLine().Append(indentString).Append(" Columns: "); foreach (var column in columns) { builder.AppendLine().Append(column.ToDebugString(options, indent + 4)); } } if ((options & MetadataDebugStringOptions.IncludeAnnotations) != 0) { builder.Append(sqlQuery.AnnotationsToDebugString(indent + 2)); } } return(builder.ToString()); }