-
-
Notifications
You must be signed in to change notification settings - Fork 324
/
Copy pathCommandEvent.cs
58 lines (51 loc) · 1.6 KB
/
CommandEvent.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
#if EF_CORE_5_OR_GREATER
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Diagnostics;
using System.Collections.Generic;
using System.Data;
using System.Text.Json.Serialization;
namespace Audit.EntityFramework
{
/// <summary>
/// Event information for command interception
/// </summary>
public class CommandEvent : InterceptorEventBase
{
/// <summary>
/// The command method (NonQuery, Scalar, Reader)
/// </summary>
public DbCommandMethod Method { get; set; }
/// <summary>
/// The command type (Text, StoredProcedure)
/// </summary>
public CommandType CommandType { get; set; }
#if NET6_0_OR_GREATER
/// <summary>
/// Indicates the source of the <see cref="T:System.Data.Common.DbCommand" /> being used to execute the command.
/// </summary>
public CommandSource CommandSource { get; set; }
#endif
/// <summary>
/// The command text
/// </summary>
public string CommandText { get; set; }
/// <summary>
/// The parameter values
/// </summary>
public Dictionary<string, object> Parameters { get; set; }
/// <summary>
/// The result of the command execution
/// </summary>
public object Result { get; set; }
[JsonIgnore]
internal DbContext DbContext { get; set; }
/// <summary>
/// Returns the DbContext associated to this event
/// </summary>
public DbContext GetDbContext()
{
return DbContext;
}
}
}
#endif