diff --git a/src/SIL.Harmony.Core/QueryHelpers.cs b/src/SIL.Harmony.Core/QueryHelpers.cs index 6562829..6be34e4 100644 --- a/src/SIL.Harmony.Core/QueryHelpers.cs +++ b/src/SIL.Harmony.Core/QueryHelpers.cs @@ -6,7 +6,7 @@ public static class QueryHelpers { public static async Task GetSyncState(this IQueryable commits) { - var dict = await commits.GroupBy(c => c.ClientId) + var dict = await commits.AsNoTracking().GroupBy(c => c.ClientId) .Select(g => new { ClientId = g.Key, DateTime = g.Max(c => c.HybridDateTime.DateTime) }) .AsAsyncEnumerable()//this is so the ticks are calculated server side instead of the db .ToDictionaryAsync(c => c.ClientId, c => c.DateTime.ToUnixTimeMilliseconds()); diff --git a/src/SIL.Harmony/Db/CrdtRepository.cs b/src/SIL.Harmony/Db/CrdtRepository.cs index 82efc83..fb86c6d 100644 --- a/src/SIL.Harmony/Db/CrdtRepository.cs +++ b/src/SIL.Harmony/Db/CrdtRepository.cs @@ -194,7 +194,7 @@ public IQueryable GetCurrentObjects() where T : class { if (_crdtConfig.Value.EnableProjectedTables) { - return _dbContext.Set(); + return _dbContext.Set().AsNoTracking(); } throw new NotSupportedException("GetCurrentObjects is not supported when not using projected tables"); }