Beispiel #1
0
        public static string ToDebugString(
            [NotNull] this IView view,
            MetadataDebugStringOptions options,
            int indent = 0)
        {
            var builder      = new StringBuilder();
            var indentString = new string(' ', indent);

            builder
            .Append(indentString)
            .Append("View: ");

            if (view.Schema != null)
            {
                builder
                .Append(view.Schema)
                .Append(".");
            }

            builder.Append(view.Name);

            if ((options & MetadataDebugStringOptions.SingleLine) == 0)
            {
                if (view.ViewDefinitionSql != null)
                {
                    builder.AppendLine().Append(indentString).Append("  DefinitionSql: ");
                    builder.AppendLine().Append(indentString).Append(new string(' ', 4)).Append(view.ViewDefinitionSql);
                }

                var mappings = view.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 = view.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(view.AnnotationsToDebugString(indent + 2));
                }
            }

            return(builder.ToString());
        }
Beispiel #2
0
        /// <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 IView view,
            MetadataDebugStringOptions options,
            [NotNull] string indent = "")
        {
            var builder = new StringBuilder();

            builder
            .Append(indent)
            .Append("View: ");

            if (view.Schema != null)
            {
                builder
                .Append(view.Schema)
                .Append(".");
            }

            builder.Append(view.Name);

            if ((options & MetadataDebugStringOptions.SingleLine) == 0)
            {
                var mappings = view.EntityTypeMappings.ToList();
                if (mappings.Count != 0)
                {
                    builder.AppendLine().Append(indent).Append("  EntityTypeMappings: ");
                    foreach (var mapping in mappings)
                    {
                        builder.AppendLine().Append(mapping.ToDebugString(options, indent + "    "));
                    }
                }

                var columns = view.Columns.ToList();
                if (columns.Count != 0)
                {
                    builder.AppendLine().Append(indent).Append("  Properties: ");
                    foreach (var column in columns)
                    {
                        builder.AppendLine().Append(column.ToDebugString(options, indent + "    "));
                    }
                }

                if ((options & MetadataDebugStringOptions.IncludeAnnotations) != 0)
                {
                    builder.Append(view.AnnotationsToDebugString(indent: indent + "  "));
                }
            }

            return(builder.ToString());
        }