/// <summary> /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to /// the same compatibility standards as public APIs. It may be changed or removed without notice in /// any release. You should only use it directly in your code with extreme caution and knowing that /// doing so can result in application failures when updating to a new Entity Framework Core release. /// </summary> public static string ToDebugString([NotNull] this IIndex index, bool singleLine = true, [NotNull] string indent = "") { var builder = new StringBuilder(); builder.Append(indent); if (singleLine) { builder.Append("Index: "); } builder .Append( string.Join( ", ", index.Properties.Select( p => singleLine ? p.DeclaringEntityType.DisplayName() + "." + p.Name : p.Name))); if (index.IsUnique) { builder.Append(" Unique"); } if (!singleLine) { builder.Append(index.AnnotationsToDebugString(indent + " ")); } return(builder.ToString()); }
/// <summary> /// <para> /// Creates a human-readable representation of the given metadata. /// </para> /// <para> /// Warning: Do not rely on the format of the returned string. /// It is designed for debugging only and may change arbitrarily between releases. /// </para> /// </summary> /// <param name="index"> The metadata item. </param> /// <param name="options"> Options for generating the string. </param> /// <param name="indent"> The number of indent spaces to use before each new line. </param> /// <returns> A human-readable representation. </returns> public static string ToDebugString( [NotNull] this IIndex index, MetadataDebugStringOptions options, int indent = 0) { var builder = new StringBuilder(); var indentString = new string(' ', indent); builder.Append(indentString); var singleLine = (options & MetadataDebugStringOptions.SingleLine) != 0; if (singleLine) { builder.Append("Index: "); } builder .AppendJoin( ", ", index.Properties.Select( p => singleLine ? p.DeclaringEntityType.DisplayName() + "." + p.Name : p.Name)); builder.Append(" " + index.Name ?? "<unnamed>"); if (index.IsUnique) { builder.Append(" Unique"); } if (!singleLine && (options & MetadataDebugStringOptions.IncludeAnnotations) != 0) { builder.Append(index.AnnotationsToDebugString(indent + 2)); } return(builder.ToString()); }
/// <summary> /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to /// the same compatibility standards as public APIs. It may be changed or removed without notice in /// any release. You should only use it directly in your code with extreme caution and knowing that /// doing so can result in application failures when updating to a new Entity Framework Core release. /// </summary> public static string ToDebugString( [NotNull] this IIndex index, DebugViewOptions options, [NotNull] string indent = "") { var builder = new StringBuilder(); builder.Append(indent); var singleLine = (options & DebugViewOptions.SingleLine) != 0; if (singleLine) { builder.Append("Index: "); } builder .AppendJoin( ", ", index.Properties.Select( p => singleLine ? p.DeclaringEntityType.DisplayName() + "." + p.Name : p.Name)); if (index.IsUnique) { builder.Append(" Unique"); } if (!singleLine && (options & DebugViewOptions.IncludeAnnotations) != 0) { builder.Append(index.AnnotationsToDebugString(indent + " ")); } return(builder.ToString()); }