aboutsummaryrefslogtreecommitdiff
path: root/docker/crupest-api/CrupestApi/CrupestApi.Commons/Crud/ColumnMetadata.cs
blob: 6f46cd5e1a4912b95cbf07f74f8cd6707d70814f (plain)
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
namespace CrupestApi.Commons.Crud;

public interface IColumnMetadata
{

}

public enum ColumnIndexType
{
    None,
    Unique,
    NonUnique
}

[AttributeUsage(AttributeTargets.Property, AllowMultiple = false)]
public class ColumnAttribute : Attribute, IColumnMetadata
{
    // if null, use the property name.
    public string? DatabaseName { get; set; }

    // default false.
    public bool NonNullable { get; set; }

    // default false
    public bool IsPrimaryKey { get; set; }

    // default false
    public bool IsAutoIncrement { get; set; }

    public ColumnIndexType IndexType { get; set; } = ColumnIndexType.None;
}