-
Notifications
You must be signed in to change notification settings - Fork 3.3k
/
Copy pathIViewColumn.cs
73 lines (61 loc) · 2.39 KB
/
IViewColumn.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Collections.Generic;
using System.Text;
using Microsoft.EntityFrameworkCore.Infrastructure;
namespace Microsoft.EntityFrameworkCore.Metadata
{
/// <summary>
/// Represents a column in a view.
/// </summary>
public interface IViewColumn : IColumnBase
{
/// <summary>
/// Gets the containing view.
/// </summary>
IView View { get; }
/// <summary>
/// Gets the property mappings.
/// </summary>
new IEnumerable<IViewColumnMapping> PropertyMappings { get; }
/// <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="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>
string ToDebugString(MetadataDebugStringOptions options = MetadataDebugStringOptions.ShortDefault, 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($"ViewColumn: {Table.Name}.");
}
builder.Append(Name).Append(" (");
builder.Append(StoreType).Append(")");
if (IsNullable)
{
builder.Append(" Nullable");
}
else
{
builder.Append(" NonNullable");
}
builder.Append(")");
if (!singleLine && (options & MetadataDebugStringOptions.IncludeAnnotations) != 0)
{
builder.Append(AnnotationsToDebugString(indent + 2));
}
return builder.ToString();
}
}
}