Skip to content

Commit cf7136d

Browse files
Update Audit
1 parent fed66e4 commit cf7136d

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

src/shared/Z.EF.Plus.Audit.Shared/AuditManager.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
// More projects: http://www.zzzprojects.com/
66
// Copyright © ZZZ Projects Inc. 2014 - 2016. All rights reserved.
77

8+
using Z.EntityFramework.Extensions;
9+
810
namespace Z.EntityFramework.Plus
911
{
1012
/// <summary>Manager for audits.</summary>
@@ -13,6 +15,8 @@ public static class AuditManager
1315
/// <summary>Static constructor.</summary>
1416
static AuditManager()
1517
{
18+
EntityFrameworkManager.IsEntityFrameworkPlus = true;
19+
1620
DefaultConfiguration = new AuditConfiguration();
1721
}
1822

src/shared/Z.EF.Plus.Audit.Shared/Extensions/DbSet`AuditEntry/DbSet`AuditEntry.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@ namespace Z.EntityFramework.Plus
2323
public static partial class AuditExtensions
2424
{
2525
public static IQueryable<AuditEntry> Where<T>(this DbSet<AuditEntry> set, T entry) where T : class
26+
{
27+
return set.Where<AuditEntry, T>(entry);
28+
}
29+
30+
public static IQueryable<TAuditEntry> Where<TAuditEntry, T>(this DbSet<TAuditEntry> set, T entry) where TAuditEntry : AuditEntry where T : class
2631
{
2732
var context = set.GetDbContext();
2833
var keyNames = context.GetKeyNames<T>();
@@ -49,6 +54,11 @@ public static IQueryable<AuditEntry> Where<T>(this DbSet<AuditEntry> set, T entr
4954
}
5055

5156
public static IQueryable<AuditEntry> Where<T>(this DbSet<AuditEntry> set, params object[] keyValues) where T : class
57+
{
58+
return set.Where<AuditEntry, T>(keyValues);
59+
}
60+
61+
public static IQueryable<TAuditEntry> Where<TAuditEntry, T>(this DbSet<TAuditEntry> set, params object[] keyValues) where TAuditEntry : AuditEntry where T : class
5262
{
5363
var context = set.GetDbContext();
5464
var keyNames = context.GetKeyNames<T>();
@@ -59,6 +69,7 @@ public static IQueryable<AuditEntry> Where<T>(this DbSet<AuditEntry> set, params
5969
{
6070
throw new Exception(ExceptionMessage.Audit_Key_Null);
6171
}
72+
6273
if (keyValues.Length != keyNames.Length)
6374
{
6475
throw new Exception(ExceptionMessage.Audit_Key_OutOfBound);

0 commit comments

Comments
 (0)