-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathAttributes.cs
99 lines (89 loc) · 2.63 KB
/
Attributes.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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
using System;
namespace Ceen.Database
{
/// <summary>
/// Overrides the item name
/// </summary>
public class NameAttribute : Attribute
{
/// <summary>
/// The name of the item
/// </summary>
public readonly string Name;
/// <summary>
/// Initializes a new instance of the <see cref="T:Ceen.Database.NameAttribute"/> class.
/// </summary>
/// <param name="name">The name to use.</param>
public NameAttribute(string name)
{
Name = name ?? throw new ArgumentNullException(nameof(name));
}
}
/// <summary>
/// The database type
/// </summary>
public class DbTypeAttribute : Attribute
{
/// <summary>
/// The type to use
/// </summary>
public readonly string Type;
/// <summary>
/// Initializes a new instance of the <see cref="T:Ceen.Database.DbTypeAttribute"/> class.
/// </summary>
/// <param name="type">The type.</param>
public DbTypeAttribute(string type)
{
Type = type ?? throw new ArgumentNullException(nameof(type));
}
}
/// <summary>
/// Marker class to make item unique
/// </summary>
public class UniqueAttribute : Attribute
{
/// <summary>
/// The unique group
/// </summary>
public readonly string Group;
/// <summary>
/// Constructs a unique attribute without a group
/// </summary>
public UniqueAttribute()
{
Group = null;
}
/// <summary>
/// Initializes a new instance of the <see cref="T:Ceen.Database.DbTypeAttribute"/> class.
/// </summary>
/// <param name="group">The unique group.</param>
public UniqueAttribute(string group)
{
Group = group ?? throw new ArgumentNullException(nameof(group));
}
}
/// <summary>
/// Attribute to mark item as primary key
/// </summary>
public class PrimaryKeyAttribute : Attribute
{
}
/// <summary>
/// A column ignore marker
/// </summary>
public class IgnoreAttribute : Attribute
{
}
/// <summary>
/// Marker attribute for setting a property or field as a creation timestamp
/// </summary>
public class CreatedTimestampAttribute : Attribute
{
}
/// <summary>
/// Marker attribute for setting a property or field as a change timestamp
/// </summary>
public class ChangedTimestampAttribute : Attribute
{
}
}