Skip to content

Commit 7c1c64e

Browse files
Update latest source
Update latest source
1 parent 4e33907 commit 7c1c64e

File tree

6 files changed

+58
-14
lines changed

6 files changed

+58
-14
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public static void AuditEntityAdded(AuditEntry auditEntry, ObjectStateEntry obje
6868
// Complex Type
6969
AuditEntityAdded(auditEntry, objectStateEntry, valueRecord, string.Concat(prefix, name, "."));
7070
}
71-
else if (objectStateEntry.EntitySet.ElementType.KeyMembers.Any(x => x.Name == name) || auditEntry.Parent.CurrentOrDefaultConfiguration.IsAuditedProperty(auditEntry.Entry, name))
71+
else if (objectStateEntry.EntitySet.ElementType.KeyMembers.Any(x => x.Name == name) || auditEntry.Parent.CurrentOrDefaultConfiguration.IsAuditedProperty(auditEntry.Entry, string.Concat(prefix, name)))
7272
{
7373
var auditEntryProperty = auditEntry.Parent.Configuration.AuditEntryPropertyFactory != null ?
7474
auditEntry.Parent.Configuration.AuditEntryPropertyFactory(new AuditEntryPropertyArgs(auditEntry, objectStateEntry, string.Concat(prefix, name), null, value)) :

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ public static void AuditEntityDeleted(AuditEntry entry, ObjectStateEntry objectS
7272
// Complex Type
7373
AuditEntityDeleted(entry, objectStateEntry, valueRecord, string.Concat(prefix, name, "."));
7474
}
75-
else if (objectStateEntry.EntityKey.EntityKeyValues.Any(x => x.Key == name) || entry.Parent.CurrentOrDefaultConfiguration.IsAuditedProperty(entry.Entry, name))
75+
else if (objectStateEntry.EntityKey.EntityKeyValues.Any(x => x.Key == name) || entry.Parent.CurrentOrDefaultConfiguration.IsAuditedProperty(entry.Entry, string.Concat(prefix, name)))
7676
{
7777
var auditEntryProperty = entry.Parent.Configuration.AuditEntryPropertyFactory != null ?
7878
entry.Parent.Configuration.AuditEntryPropertyFactory(new AuditEntryPropertyArgs(entry, objectStateEntry, string.Concat(prefix, name), value, null)) :

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,8 @@ public static void AuditEntityModified(Audit audit, AuditEntry entry, ObjectStat
8181
AuditEntityModified(audit, entry, objectStateEntry, valueRecord, currentValue as DbUpdatableDataRecord, string.Concat(prefix, name, "."));
8282
}
8383

84-
else if (objectStateEntry.EntityKey.EntityKeyValues.Any(x => x.Key == name)
85-
|| entry.Parent.CurrentOrDefaultConfiguration.IsAuditedProperty(entry.Entry, name))
84+
else if (objectStateEntry.EntityKey.EntityKeyValues.Any(x => x.Key == name)
85+
|| entry.Parent.CurrentOrDefaultConfiguration.IsAuditedProperty(entry.Entry, string.Concat(prefix, name)))
8686
{
8787
if (!audit.Configuration.IgnorePropertyUnchanged
8888
|| objectStateEntry.EntityKey.EntityKeyValues.Any(x => x.Key == name)

src/shared/Z.EF.Plus.BatchUpdate.Shared/BatchUpdate.cs

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1183,6 +1183,15 @@ public List<Tuple<string, object>> GetInnerValues<T>(IQueryable<T> query, Expres
11831183
"[Extent7]",
11841184
"[Extent8]",
11851185
"[Extent9]",
1186+
"[Join1]",
1187+
"[Join2]",
1188+
"[Join3]",
1189+
"[Join4]",
1190+
"[Join5]",
1191+
"[Join6]",
1192+
"[Join7]",
1193+
"[Join8]",
1194+
"[Join9]",
11861195
"[Filter1]",
11871196
"[Filter2]",
11881197
"[Filter3]",
@@ -1198,6 +1207,15 @@ public List<Tuple<string, object>> GetInnerValues<T>(IQueryable<T> query, Expres
11981207
"`Extent7`",
11991208
"`Extent8`",
12001209
"`Extent9`",
1210+
"`Join1`",
1211+
"`Join2`",
1212+
"`Join3`",
1213+
"`Join4`",
1214+
"`Join5`",
1215+
"`Join6`",
1216+
"`Join7`",
1217+
"`Join8`",
1218+
"`Join9`",
12011219
"`Filter1`",
12021220
"`Filter2`",
12031221
"`Filter3`",
@@ -1213,21 +1231,29 @@ public List<Tuple<string, object>> GetInnerValues<T>(IQueryable<T> query, Expres
12131231
"\"Extent7\"",
12141232
"\"Extent8\"",
12151233
"\"Extent9\"",
1216-
"\"Filter1\"",
1234+
"\"Join1\"",
1235+
"\"Join2\"",
1236+
"\"Join3\"",
1237+
"\"Join4\"",
1238+
"\"Join5\"",
1239+
"\"Join6\"",
1240+
"\"Join7\"",
1241+
"\"Join8\"",
1242+
"\"Join9\"",
1243+
"\"Filter1\"",
12171244
"\"Filter2\"",
12181245
"\"Filter3\"",
12191246
"\"Filter4\"",
12201247
"\"Filter5\"",
12211248
"\"Filter6\"",
12221249
};
12231250

1224-
// Replace the first value found only!
1251+
// Before we were replacing only the first value, we might have added an issue here by removing the break.
12251252
foreach (var itemReplace in listReplace)
12261253
{
12271254
if (valueSql.Contains(itemReplace))
12281255
{
1229-
valueSql = valueSql.Replace(itemReplace, "B");
1230-
break;
1256+
valueSql = valueSql.Replace(itemReplace, "B");
12311257
}
12321258
}
12331259

src/shared/Z.EF.Plus.QueryFilter.Shared/QueryFilterManager.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ static QueryFilterManager()
5757
GlobalFilters = new Dictionary<object, AliasBaseQueryFilter>();
5858
GlobalInitializeFilterActions = new List<Tuple<AliasBaseQueryFilter, Action<AliasBaseQueryFilter>>>();
5959

60-
#if NETSTANDARD2_0
60+
#if NETSTANDARD2_0 && !EFCLASSIC
6161
ForceCast = true;
6262
#endif
6363
}

src/shared/Z.EF.Plus.QueryFuture.Shared/BaseQueryFuture.cs

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@
99
using System.Collections.Generic;
1010
using System.Data.Common;
1111
using System.Reflection;
12-
13-
1412
#if NET45
1513
using System.Threading;
1614
using System.Threading.Tasks;
@@ -36,6 +34,8 @@
3634
using Microsoft.EntityFrameworkCore.Storage;
3735
using Remotion.Linq.Parsing.ExpressionVisitors.TreeEvaluation;
3836
using Remotion.Linq.Parsing.Structure;
37+
using Microsoft.EntityFrameworkCore.Query.Expressions;
38+
using Remotion.Linq.Clauses;
3939

4040
#endif
4141

@@ -326,16 +326,34 @@ public virtual IRelationalCommand CreateExecutorAndGetCommand(out RelationalQuer
326326
// SET value
327327
QueryExecutor = queryExecutor;
328328
QueryContext = queryContext;
329+
SelectExpression sqlQuery = null;
330+
331+
if (queryModelVisitor.Queries.Count == 0)
332+
{
333+
var _subQueryModelVisitorsBySource = queryModelVisitor.GetType().GetField("_subQueryModelVisitorsBySource", BindingFlags.NonPublic | BindingFlags.Instance);
334+
var subQueryModelVisitorsBySources = (Dictionary<IQuerySource, RelationalQueryModelVisitor>)_subQueryModelVisitorsBySource.GetValue(queryModelVisitor);
335+
if (subQueryModelVisitorsBySources.Count == 1)
336+
{
337+
sqlQuery = subQueryModelVisitorsBySources.First().Value.Queries.First();
338+
}
339+
else
340+
{
341+
throw new Exception("More than one query has been found inside the same query.");
342+
}
343+
}
344+
else
345+
{
346+
sqlQuery = queryModelVisitor.Queries.First();
347+
}
329348

330349
// RETURN the IRealationCommand
331-
var sqlQuery = queryModelVisitor.Queries.First();
332350
var relationalCommand = sqlQuery.CreateDefaultQuerySqlGenerator().GenerateSql(queryContext.ParameterValues);
333351
return relationalCommand;
334352
}
335353
#endif
336354

337-
/// <summary>Sets the result of the query deferred.</summary>
338-
/// <param name="reader">The reader returned from the query execution.</param>
355+
/// <summary>Sets the result of the query deferred.</summary>
356+
/// <param name="reader">The reader returned from the query execution.</param>
339357
public virtual void SetResult(DbDataReader reader)
340358
{
341359
}

0 commit comments

Comments
 (0)