-
-
Notifications
You must be signed in to change notification settings - Fork 324
/
Copy pathAuditEventEnvironment.cs
74 lines (64 loc) · 2.51 KB
/
AuditEventEnvironment.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
using System.Collections.Generic;
using System.Text.Json.Serialization;
namespace Audit.Core
{
public class AuditEventEnvironment : IAuditOutput
{
/// <summary>
/// Gets or sets the name of the user responsible for the change.
/// </summary>
public string UserName { get; set; }
/// <summary>
/// Gets or sets the name of the machine.
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string MachineName { get; set; }
/// <summary>
/// Gets or sets the name of the domain.
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string DomainName { get; set; }
/// <summary>
/// The name of the method that has the audited code
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string CallingMethodName { get; set; }
/// <summary>
/// The full stack trace
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string StackTrace { get; set; }
/// <summary>
/// The name of the assembly from where the audit scope was invoked
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string AssemblyName { get; set; }
/// <summary>
/// The exception information (if any)
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string Exception { get; set; }
/// <summary>
/// The locale name
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string Culture { get; set; }
[JsonExtensionData]
public Dictionary<string, object> CustomFields { get; set; } = new Dictionary<string, object>();
/// <summary>
/// Serializes this Environment entity as a JSON string
/// </summary>
public string ToJson()
{
return Configuration.JsonAdapter.Serialize(this);
}
/// <summary>
/// Parses an Environment entity from its JSON string representation.
/// </summary>
/// <param name="json">JSON string with the Environment entity representation.</param>
public static AuditEventEnvironment FromJson(string json)
{
return Configuration.JsonAdapter.Deserialize<AuditEventEnvironment>(json);
}
}
}