-
Notifications
You must be signed in to change notification settings - Fork 2.7k
/
LogDto.cs
60 lines (49 loc) · 1.87 KB
/
LogDto.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
using NPoco;
using Umbraco.Cms.Core;
using Umbraco.Cms.Infrastructure.Persistence.DatabaseAnnotations;
using Umbraco.Cms.Infrastructure.Persistence.DatabaseModelDefinitions;
namespace Umbraco.Cms.Infrastructure.Persistence.Dtos;
[TableName(TableName)]
[PrimaryKey("id")]
[ExplicitColumns]
internal class LogDto
{
public const string TableName = Constants.DatabaseSchema.Tables.Log;
private int? _userId;
[Column("id")]
[PrimaryKeyColumn]
public int Id { get; set; }
[Column("userId")]
[ForeignKey(typeof(UserDto))]
[NullSetting(NullSetting = NullSettings.Null)]
public int? UserId { get => _userId == 0 ? null : _userId; set => _userId = value; } // return null if zero
[Column("NodeId")]
[Index(IndexTypes.NonClustered, Name = "IX_umbracoLog")]
public int NodeId { get; set; }
/// <summary>
/// This is the entity type associated with the log
/// </summary>
[Column("entityType")]
[Length(50)]
[NullSetting(NullSetting = NullSettings.Null)]
public string? EntityType { get; set; }
[Column("Datestamp")]
[Constraint(Default = SystemMethods.CurrentDateTime)]
[Index(IndexTypes.NonClustered, Name = "IX_" + TableName + "_datestamp", ForColumns = "Datestamp,userId,NodeId")]
public DateTime Datestamp { get; set; }
[Column("logHeader")]
[Length(50)]
[Index(IndexTypes.NonClustered, Name = "IX_" + TableName + "_datestamp_logheader", ForColumns = "Datestamp,logHeader")]
public string Header { get; set; } = null!;
[Column("logComment")]
[NullSetting(NullSetting = NullSettings.Null)]
[Length(4000)]
public string? Comment { get; set; }
/// <summary>
/// Used to store additional data parameters for the log
/// </summary>
[Column("parameters")]
[NullSetting(NullSetting = NullSettings.Null)]
[Length(500)]
public string? Parameters { get; set; }
}