/// <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="columnMapping"> 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 IColumnMapping columnMapping, 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("ColumnMapping: "); } builder .Append(columnMapping.Property.DeclaringEntityType.DisplayName()) .Append(".") .Append(columnMapping.Property.Name) .Append(" - "); builder .Append(columnMapping.Column.Table.Name) .Append(".") .Append(columnMapping.Column.Name); if (!singleLine && (options & MetadataDebugStringOptions.IncludeAnnotations) != 0) { builder.Append(columnMapping.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 IColumnMapping columnMapping, MetadataDebugStringOptions options, [NotNull] string indent = "") { var builder = new StringBuilder(); builder.Append(indent); var singleLine = (options & MetadataDebugStringOptions.SingleLine) != 0; if (singleLine) { builder.Append($"ColumnMapping: "); } builder.Append(columnMapping.Property.Name).Append(" - "); builder.Append(columnMapping.Column.Name); if (!singleLine && (options & MetadataDebugStringOptions.IncludeAnnotations) != 0) { builder.Append(columnMapping.AnnotationsToDebugString(indent + " ")); } return(builder.ToString()); }