示例#1
0
        public static string ToDebugString(
            [NotNull] this IReadOnlyIndex 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());
        }