/
DisplayColumnAttribute.cs
36 lines (30 loc) · 1.15 KB
/
DisplayColumnAttribute.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
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
namespace System.ComponentModel.DataAnnotations
{
/// <summary>
/// Sets the display column, the sort column, and the sort order for when a table is used as a parent table in FK
/// relationships.
/// </summary>
[AttributeUsage(AttributeTargets.Class, Inherited = true, AllowMultiple = false)]
public class DisplayColumnAttribute : Attribute
{
public DisplayColumnAttribute(string displayColumn)
: this(displayColumn, null)
{
}
public DisplayColumnAttribute(string displayColumn, string? sortColumn)
: this(displayColumn, sortColumn, false)
{
}
public DisplayColumnAttribute(string displayColumn, string? sortColumn, bool sortDescending)
{
DisplayColumn = displayColumn;
SortColumn = sortColumn;
SortDescending = sortDescending;
}
public string DisplayColumn { get; }
public string? SortColumn { get; }
public bool SortDescending { get; }
}
}