public static string ToDebugString( [NotNull] this IUniqueConstraint uniqueConstraint, 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("Key: "); } builder .Append(uniqueConstraint.Name) .Append(" ") .Append(ColumnBase.Format(uniqueConstraint.Columns)); if (uniqueConstraint.GetIsPrimaryKey()) { builder.Append(" PrimaryKey"); } if (!singleLine && (options & MetadataDebugStringOptions.IncludeAnnotations) != 0) { builder.Append(uniqueConstraint.AnnotationsToDebugString(indent + 2)); } 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="foreignKey"> 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 IForeignKeyConstraint foreignKey, 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("ForeignKey: "); } builder .Append(foreignKey.Name) .Append(" ") .Append(foreignKey.Table.Name) .Append(" ") .Append(ColumnBase.Format(foreignKey.Columns)) .Append(" -> ") .Append(foreignKey.PrincipalTable.Name) .Append(" ") .Append(ColumnBase.Format(foreignKey.PrincipalColumns)); if (foreignKey.OnDeleteAction != ReferentialAction.NoAction) { builder .Append(" ") .Append(foreignKey.OnDeleteAction); } if (!singleLine && (options & MetadataDebugStringOptions.IncludeAnnotations) != 0) { builder.Append(foreignKey.AnnotationsToDebugString(indent + 2)); } 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 ITableIndex 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 .Append(index.Name) .Append(" ") .Append(ColumnBase.Format(index.Columns)); if (index.IsUnique) { builder .Append(" Unique"); } if (!string.IsNullOrWhiteSpace(index.Filter)) { builder .Append(" Filtered"); } if (!singleLine && (options & MetadataDebugStringOptions.IncludeAnnotations) != 0) { builder.Append(index.AnnotationsToDebugString(indent + 2)); } return(builder.ToString()); }