AsNoTracking()
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
using Google.Apis.Auth;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.IdentityModel.Tokens;
|
||||
using System.IdentityModel.Tokens.Jwt;
|
||||
using System.Security.Claims;
|
||||
@@ -28,7 +29,7 @@ public class AuthController : Controller
|
||||
Audience = new List<string> { _configuration.GetValue<string>("GoogleClientId")! }
|
||||
};
|
||||
var payload = await GoogleJsonWebSignature.ValidateAsync(credential, settings);
|
||||
var user = _db.Users.FirstOrDefault(x => x.Email == payload.Email);
|
||||
var user = _db.Users.AsNoTracking().FirstOrDefault(x => x.Email == payload.Email);
|
||||
return user != null ? (IActionResult)Ok(JwtGenerator(user)) : Unauthorized();
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ using System.Text;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Data.SqlClient;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using WebAPI.Models;
|
||||
|
||||
namespace WebAPI.Controllers;
|
||||
@@ -131,7 +132,7 @@ public class DataInboxController : Controller
|
||||
[HttpGet]
|
||||
public IActionResult GetAll()
|
||||
{
|
||||
return Ok(_db.DataInbox);
|
||||
return Ok(_db.DataInbox.AsNoTracking().ToList());
|
||||
}
|
||||
|
||||
// helpers
|
||||
|
||||
@@ -57,7 +57,7 @@ public class LayersController : Controller
|
||||
|
||||
return Ok(response
|
||||
.OrderByDescending(x => x.Number)
|
||||
.Skip(start).Take(limit).ToList());
|
||||
.Skip(start).Take(limit).AsNoTracking().ToList());
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
@@ -73,7 +73,7 @@ public class LayersController : Controller
|
||||
{
|
||||
return Ok(_db.Layers
|
||||
.Include(x => x.CreatedBy)
|
||||
.Include(x => x.Records).First(x => x.Id == id && !x.IsDeleted));
|
||||
.Include(x => x.Records).AsNoTracking().First(x => x.Id == id && !x.IsDeleted));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
@@ -150,7 +150,7 @@ public class LayersController : Controller
|
||||
|
||||
return Ok(_db.Layers
|
||||
.Include(x => x.CreatedBy)
|
||||
.Include(x => x.Records).First(x => x.Number == number && !x.IsDeleted));
|
||||
.Include(x => x.Records).AsNoTracking().First(x => x.Number == number && !x.IsDeleted));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
@@ -175,7 +175,7 @@ public class LayersController : Controller
|
||||
}
|
||||
|
||||
var layer = _db.Layers
|
||||
.Include(x => x.Records!.OrderByDescending(y => y.Code)).First(x => x.Id == id && !x.IsDeleted);
|
||||
.Include(x => x.Records!.OrderByDescending(y => y.Code)).AsNoTracking().First(x => x.Id == id && !x.IsDeleted);
|
||||
|
||||
var export = new GoogleSheetExport(_googleDriveHelper, _googleSheetValues, _configuration);
|
||||
export.Export(layer);
|
||||
@@ -199,6 +199,7 @@ public class LayersController : Controller
|
||||
x.Records!.Any(y => y.Code == "IsEnabled" && y.Desc1 == "True")
|
||||
)
|
||||
.OrderBy(x => x.CreatedAt)
|
||||
.AsNoTracking()
|
||||
.ToList();
|
||||
|
||||
if (importWorkerLayers.Count == 0)
|
||||
@@ -282,6 +283,7 @@ public class LayersController : Controller
|
||||
x.Records!.Any(y => y.Code == "IsEnabled" && y.Desc1 == "True")
|
||||
)
|
||||
.OrderByDescending(x => x.CreatedAt)
|
||||
.AsNoTracking()
|
||||
.ToList();
|
||||
_logsController.AddEntry(new LogEntry
|
||||
{
|
||||
@@ -482,6 +484,7 @@ public class LayersController : Controller
|
||||
x.Records!.Any(y => y.Code == "ProcessType" && y.Desc1 == type)
|
||||
)
|
||||
.OrderBy(x => x.CreatedAt)
|
||||
.AsNoTracking()
|
||||
.ToList();
|
||||
|
||||
if (processWorkerLayers.Count == 0)
|
||||
@@ -596,21 +599,6 @@ public class LayersController : Controller
|
||||
});
|
||||
return;
|
||||
}
|
||||
case "T1-R1_OLD":
|
||||
{
|
||||
var processor = new T1R1OldProcessor(_db, _googleSheetValues, this, _logsController);
|
||||
processor.Process(processWorker);
|
||||
|
||||
_logsController.AddEntry(new LogEntry
|
||||
{
|
||||
Title = $"{processWorker.Name}, {processWorker.Id}",
|
||||
Type = LogEntryType.Info,
|
||||
LogType = LogType.Process,
|
||||
Message = "Success",
|
||||
CreatedAt = DateTime.UtcNow
|
||||
});
|
||||
return;
|
||||
}
|
||||
case "T1-R1":
|
||||
{
|
||||
var processor = new T1R1Processor(_db, _googleSheetValues, this, _logsController);
|
||||
@@ -748,6 +736,7 @@ public class LayersController : Controller
|
||||
.Include(x => x.Records)
|
||||
.Where(x => x.ParentId == importWorker.Id)
|
||||
.OrderByDescending(x => x.CreatedAt)
|
||||
.AsNoTracking()
|
||||
.FirstOrDefault();
|
||||
|
||||
if (newestLayer is null)
|
||||
|
||||
@@ -1,261 +0,0 @@
|
||||
using System.Globalization;
|
||||
using DiunaBIWebAPI.dataProcessors;
|
||||
using Google.Apis.Sheets.v4;
|
||||
using Google.Apis.Sheets.v4.Data;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using WebAPI.Controllers;
|
||||
using WebAPI.Models;
|
||||
|
||||
namespace WebAPI.dataProcessors;
|
||||
|
||||
public class T1R1OldProcessor(
|
||||
AppDbContext db,
|
||||
SpreadsheetsResource.ValuesResource googleSheetValues,
|
||||
LayersController controller,
|
||||
LogsController logsController)
|
||||
{
|
||||
public void Process(Layer processWorker)
|
||||
{
|
||||
var year = int.Parse(processWorker.Records?.SingleOrDefault(x => x.Code == "Year")?.Desc1!);
|
||||
var sources = processWorker.Records?.Where(x => x.Code == "Source").ToList();
|
||||
if (sources!.Count == 0)
|
||||
{
|
||||
throw new Exception("Source record not found");
|
||||
}
|
||||
var codes = processWorker.Records?.SingleOrDefault(x => x.Code == "Codes")?.Desc1;
|
||||
if (codes == null)
|
||||
{
|
||||
throw new Exception("Codes record not found");
|
||||
}
|
||||
var codesList = ProcessHelper.ParseCodes(codes);
|
||||
|
||||
var processedLayer = db.Layers
|
||||
.Where(x => x.ParentId == processWorker.Id
|
||||
&& !x.IsDeleted)
|
||||
.OrderByDescending(x => x.CreatedAt)
|
||||
.FirstOrDefault();
|
||||
|
||||
var isNew = false;
|
||||
if (processedLayer == null)
|
||||
{
|
||||
isNew = true;
|
||||
processedLayer = new Layer
|
||||
{
|
||||
Id = Guid.NewGuid(),
|
||||
Type = LayerType.Processed,
|
||||
ParentId = processWorker.Id,
|
||||
Number = db.Layers.Count() + 1
|
||||
};
|
||||
processedLayer.Name = $"L{processedLayer.Number}-P-{year}-R1-T1";
|
||||
processedLayer.CreatedById = Guid.Parse("F392209E-123E-4651-A5A4-0B1D6CF9FF9D");
|
||||
processedLayer.ModifiedById = Guid.Parse("F392209E-123E-4651-A5A4-0B1D6CF9FF9D");
|
||||
processedLayer.CreatedAt = DateTime.UtcNow;
|
||||
processedLayer.ModifiedAt = DateTime.UtcNow;
|
||||
}
|
||||
|
||||
processedLayer.ModifiedById = Guid.Parse("F392209E-123E-4651-A5A4-0B1D6CF9FF9D");
|
||||
processedLayer.ModifiedAt = DateTime.UtcNow;
|
||||
|
||||
var dataSources = new List<Layer>();
|
||||
|
||||
foreach (var source in sources)
|
||||
{
|
||||
for (var month = 1; month <= DateTime.UtcNow.Month; month++)
|
||||
{
|
||||
var monthCopy = month;
|
||||
var dataSource = db.Layers.Where(x =>
|
||||
x.Type == LayerType.Processed &&
|
||||
!x.IsDeleted &&
|
||||
x.Name != null && x.Name.Contains($"{year}/{monthCopy:D2}-{source.Desc1}-T3")
|
||||
)
|
||||
.Include(x => x.Records)
|
||||
.FirstOrDefault();
|
||||
if (dataSource != null)
|
||||
{
|
||||
dataSources.Add(dataSource);
|
||||
}
|
||||
else
|
||||
{
|
||||
logsController.AddEntry(new LogEntry
|
||||
{
|
||||
Title = $"{processWorker.Name}, {processWorker.Id}",
|
||||
Type = LogEntryType.Warning,
|
||||
LogType = LogType.Process,
|
||||
Message = $"Data source {year}/{month:D2}-{source.Desc1}-T3 not found",
|
||||
CreatedAt = DateTime.UtcNow
|
||||
});
|
||||
}
|
||||
}
|
||||
// year summary
|
||||
var dataSourceSum = db.Layers.Where(x =>
|
||||
x.Type == LayerType.Processed &&
|
||||
!x.IsDeleted &&
|
||||
x.Name != null && x.Name.Contains($"{year}/13-{source.Desc1}-T3")
|
||||
)
|
||||
.Include(x => x.Records)
|
||||
.FirstOrDefault();
|
||||
if (dataSourceSum != null)
|
||||
{
|
||||
dataSources.Add(dataSourceSum);
|
||||
}
|
||||
else
|
||||
{
|
||||
logsController.AddEntry(new LogEntry
|
||||
{
|
||||
Title = $"{processWorker.Name}, {processWorker.Id}",
|
||||
Type = LogEntryType.Warning,
|
||||
LogType = LogType.Process,
|
||||
Message = $"Data source {year}/13-{source.Desc1}-T3 not found",
|
||||
CreatedAt = DateTime.UtcNow
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (dataSources.Count == 0)
|
||||
{
|
||||
throw new Exception("DataSources are empty");
|
||||
}
|
||||
|
||||
var newRecords = dataSources
|
||||
.SelectMany(x => x.Records!)
|
||||
.Where(x => codesList.Contains(int.Parse(x.Code!)))
|
||||
.Select(x =>
|
||||
{
|
||||
var layer = dataSources.SingleOrDefault(y => y.Id == x.LayerId);
|
||||
var postFix = layer!.Name!.Split("/")[1].Split("-")[0];
|
||||
if (postFix.Length == 1)
|
||||
{
|
||||
postFix = "0" + postFix;
|
||||
}
|
||||
|
||||
var newRecord = new Record
|
||||
{
|
||||
Id = Guid.NewGuid(),
|
||||
Code = x.Code + postFix,
|
||||
CreatedAt = DateTime.UtcNow,
|
||||
ModifiedAt = DateTime.UtcNow,
|
||||
Value1 = x.Value32
|
||||
};
|
||||
|
||||
return newRecord;
|
||||
})
|
||||
.ToList();
|
||||
if (isNew)
|
||||
{
|
||||
db.Layers.Add(processedLayer);
|
||||
}
|
||||
else
|
||||
{
|
||||
db.Layers.Update(processedLayer);
|
||||
}
|
||||
controller.SaveRecords(processedLayer.Id, newRecords, Guid.Parse("F392209E-123E-4651-A5A4-0B1D6CF9FF9D"));
|
||||
db.SaveChanges();
|
||||
|
||||
UpdateReport();
|
||||
}
|
||||
|
||||
private void UpdateReport()
|
||||
{
|
||||
const string sheetId = "1pph-XowjlK5CIaCEV_A5buK4ceJ0Z0YoUlDI4VMkhhA";
|
||||
const string sheetName = "OLD_Raport_R1_Eksport";
|
||||
var request = googleSheetValues.Get(sheetId, "C4:EX4");
|
||||
var response = request.Execute();
|
||||
|
||||
var r1 = db.Layers
|
||||
.Where(x => x.Number == 1205)
|
||||
.Include(x => x.Records)
|
||||
.FirstOrDefault();
|
||||
|
||||
const int startRow = 6;
|
||||
|
||||
var codesRow = response.Values[0];
|
||||
for (var i = 1; i <= DateTime.UtcNow.Month; i++)
|
||||
{
|
||||
var values = new List<object>();
|
||||
var month = i < 10 ? $"0{i}" : i.ToString();
|
||||
var row = (startRow + i).ToString();
|
||||
foreach (string code in codesRow)
|
||||
{
|
||||
var record = r1!.Records?.SingleOrDefault(x => x.Code == $"{code}{month}");
|
||||
if (record != null)
|
||||
{
|
||||
values.Add(record.Value1!.Value);
|
||||
}
|
||||
else
|
||||
{
|
||||
values.Add("0");
|
||||
}
|
||||
}
|
||||
var valueRange = new ValueRange
|
||||
{
|
||||
Values = new List<IList<object>> { values }
|
||||
};
|
||||
var update = googleSheetValues.Update(valueRange, sheetId, $"{sheetName}!C{row}:XZ{row}");
|
||||
update.ValueInputOption = SpreadsheetsResource.ValuesResource.UpdateRequest.ValueInputOptionEnum.USERENTERED;
|
||||
update.Execute();
|
||||
}
|
||||
|
||||
// sum
|
||||
var valuesSum = new List<object>();
|
||||
var emptyRow = new List<object>();
|
||||
var rowEmpty = (startRow + DateTime.UtcNow.Month + 1).ToString();
|
||||
var rowSum = (startRow + DateTime.UtcNow.Month + 2).ToString();
|
||||
foreach (string code in codesRow)
|
||||
{
|
||||
var record = r1!.Records?.SingleOrDefault(x => x.Code == $"{code}13");
|
||||
emptyRow.Add("");
|
||||
if (record != null)
|
||||
{
|
||||
valuesSum.Add(record.Value1!.Value);
|
||||
}
|
||||
else
|
||||
{
|
||||
valuesSum.Add("0");
|
||||
}
|
||||
}
|
||||
// insert empty row before sum
|
||||
var valueRangeEmpty = new ValueRange
|
||||
{
|
||||
Values = new List<IList<object>> { emptyRow }
|
||||
};
|
||||
var updateEmpty = googleSheetValues.Update(valueRangeEmpty, sheetId, $"{sheetName}!C{rowEmpty}:XZ{rowEmpty}");
|
||||
updateEmpty.ValueInputOption = SpreadsheetsResource.ValuesResource.UpdateRequest.ValueInputOptionEnum.USERENTERED;
|
||||
updateEmpty.Execute();
|
||||
|
||||
var valueRangeSum = new ValueRange
|
||||
{
|
||||
Values = new List<IList<object>> { valuesSum }
|
||||
};
|
||||
var updateSum = googleSheetValues.Update(valueRangeSum, sheetId, $"{sheetName}!C{rowSum}:XZ{rowSum}");
|
||||
updateSum.ValueInputOption = SpreadsheetsResource.ValuesResource.UpdateRequest.ValueInputOptionEnum.USERENTERED;
|
||||
updateSum.Execute();
|
||||
|
||||
// update time
|
||||
var timeUtc = new List<object>
|
||||
{
|
||||
r1!.ModifiedAt.ToString("dd.MM.yyyy HH:mm:ss", CultureInfo.GetCultureInfo("pl-PL"))
|
||||
};
|
||||
var valueRangeUtcTime = new ValueRange
|
||||
{
|
||||
Values = new List<IList<object>> { timeUtc }
|
||||
};
|
||||
var updateTimeUtc = googleSheetValues.Update(valueRangeUtcTime, sheetId, $"{sheetName}!G1");
|
||||
updateTimeUtc.ValueInputOption = SpreadsheetsResource.ValuesResource.UpdateRequest.ValueInputOptionEnum.USERENTERED;
|
||||
updateTimeUtc.Execute();
|
||||
|
||||
var warsawTimeZone = TimeZoneInfo.FindSystemTimeZoneById("Central European Standard Time");
|
||||
var warsawTime = TimeZoneInfo.ConvertTimeFromUtc(r1.ModifiedAt.ToUniversalTime(), warsawTimeZone);
|
||||
var timeWarsaw = new List<object>
|
||||
{
|
||||
warsawTime.ToString("dd.MM.yyyy HH:mm:ss", CultureInfo.GetCultureInfo("pl-PL"))
|
||||
};
|
||||
var valueRangeWarsawTime = new ValueRange
|
||||
{
|
||||
Values = new List<IList<object>> { timeWarsaw }
|
||||
};
|
||||
var updateTimeWarsaw = googleSheetValues.Update(valueRangeWarsawTime, sheetId, $"{sheetName}!G2");
|
||||
updateTimeWarsaw.ValueInputOption = SpreadsheetsResource.ValuesResource.UpdateRequest.ValueInputOptionEnum.USERENTERED;
|
||||
updateTimeWarsaw.Execute();
|
||||
}
|
||||
}
|
||||
@@ -73,6 +73,7 @@ public class T1R1Processor(
|
||||
!x.IsDeleted &&
|
||||
x.Name != null && x.Name.Contains($"{year}/{monthCopy:D2}-{source.Desc1}-T3")
|
||||
).Include(x => x.Records)
|
||||
.AsNoTracking()
|
||||
.FirstOrDefault();
|
||||
|
||||
if (dataSource == null)
|
||||
@@ -197,6 +198,7 @@ public class T1R1Processor(
|
||||
var r1 = db.Layers
|
||||
.Where(x => x.Id == sourceId)
|
||||
.Include(x => x.Records)
|
||||
.AsNoTracking()
|
||||
.FirstOrDefault();
|
||||
|
||||
var codesRow = response.Values[0];
|
||||
|
||||
@@ -57,6 +57,7 @@ public class T1R3Processor(
|
||||
var dataSources = db.Layers
|
||||
.Where(x => !x.IsDeleted)
|
||||
.Include(layer => layer.Records!)
|
||||
.AsNoTracking()
|
||||
.AsEnumerable()
|
||||
.Where(x => Regex.IsMatch(x.Name!, pattern))
|
||||
.ToList();
|
||||
@@ -106,18 +107,19 @@ public class T1R3Processor(
|
||||
UpdateReport(processedLayer.Id, year);
|
||||
}
|
||||
|
||||
private void UpdateReport(Guid LayerId, int Year)
|
||||
private void UpdateReport(Guid sourceId, int year)
|
||||
{
|
||||
const string sheetId = "10Xo8BBF92nM7_JzzeOuWp49Gz8OsYuCxLDOeChqpW_8";
|
||||
|
||||
var r3 = db.Layers
|
||||
.Where(x => x.Id == LayerId)
|
||||
.Where(x => x.Id == sourceId)
|
||||
.Include(x => x.Records)
|
||||
.AsNoTracking()
|
||||
.FirstOrDefault();
|
||||
|
||||
for (var i = 1; i <= 12; i++)
|
||||
{
|
||||
var sheetName = ProcessHelper.GetSheetName(i, Year);
|
||||
var sheetName = ProcessHelper.GetSheetName(i, year);
|
||||
ValueRange? dataRangeResponse;
|
||||
try
|
||||
{
|
||||
|
||||
@@ -53,8 +53,9 @@ public class T3MultiSourceCopySelectedCodesProcessor(
|
||||
processedLayer.ModifiedById = Guid.Parse("F392209E-123E-4651-A5A4-0B1D6CF9FF9D");
|
||||
processedLayer.ModifiedAt = DateTime.UtcNow;
|
||||
|
||||
var dataSources = sources.Select(source => db.Layers.Where(x => x.Type == LayerType.Processed && !x.IsDeleted && x.Name != null && x.Name.Contains($"{year}/{month:D2}-{source.Desc1}-T3"))
|
||||
.Include(x => x.Records)
|
||||
var dataSources = sources.Select(source => db.Layers
|
||||
.Where(x => x.Type == LayerType.Processed && !x.IsDeleted && x.Name != null && x.Name.Contains($"{year}/{month:D2}-{source.Desc1}-T3"))
|
||||
.Include(x => x.Records).AsNoTracking()
|
||||
.FirstOrDefault())
|
||||
.OfType<Layer>()
|
||||
.ToList();
|
||||
|
||||
@@ -52,6 +52,7 @@ public class T3MultiSourceCopySelectedCodesYearSummaryProcessor(
|
||||
&& !x.IsDeleted
|
||||
&& x.Name != null && x.Name.Contains($"{year}/{j:D2}-AB-T3"))
|
||||
.Include(x => x.Records)
|
||||
.AsNoTracking()
|
||||
.FirstOrDefault();
|
||||
if (dataSource != null)
|
||||
{
|
||||
|
||||
@@ -52,6 +52,7 @@ public class T3MultiSourceSummaryProcessor(
|
||||
|
||||
var dataSources = sources.Select(source => db.Layers.Where(x => x.Type == LayerType.Processed && !x.IsDeleted && x.Name != null && x.Name.Contains($"{year}/{month:D2}-{source.Desc1}-T3"))
|
||||
.Include(x => x.Records)
|
||||
.AsNoTracking()
|
||||
.FirstOrDefault())
|
||||
.OfType<Layer>()
|
||||
.ToList();
|
||||
|
||||
@@ -51,6 +51,7 @@ public class T3MultiSourceYearSummaryProcessor(
|
||||
|
||||
var dataSources = sources.Select(source => db.Layers.Where(x => x.Type == LayerType.Processed && !x.IsDeleted && x.Name != null && x.Name.Contains($"{year}/13-{source.Desc1}-T3"))
|
||||
.Include(x => x.Records)
|
||||
.AsNoTracking()
|
||||
.FirstOrDefault())
|
||||
.OfType<Layer>()
|
||||
.ToList();
|
||||
|
||||
@@ -63,6 +63,7 @@ public class T3SingleSourceProcessor(
|
||||
.Where(x => x.ParentId == sourceImportWorker.Id
|
||||
&& !x.IsDeleted)
|
||||
.OrderBy(x => x.CreatedAt)
|
||||
.AsNoTracking()
|
||||
.ToList();
|
||||
if (dataSources.Count == 0)
|
||||
{
|
||||
|
||||
@@ -55,6 +55,7 @@ public class T3SourceYearSummaryProcessor(
|
||||
&& !x.IsDeleted
|
||||
&& x.Name!=null && x.Name.Contains($"{year}/{j:D2}-{source}-T3"))
|
||||
.Include(x => x.Records)
|
||||
.AsNoTracking()
|
||||
.FirstOrDefault();
|
||||
if (dataSource != null)
|
||||
{
|
||||
|
||||
@@ -60,6 +60,7 @@ public class T4SingleSourceProcessor(
|
||||
.Where(x => x.ParentId == sourceImportWorker.Id
|
||||
&& !x.IsDeleted)
|
||||
.OrderByDescending(x => x.CreatedAt)
|
||||
.AsNoTracking()
|
||||
.FirstOrDefault();
|
||||
|
||||
if (dataSource == null)
|
||||
|
||||
@@ -84,6 +84,7 @@ public class T4R2Processor(
|
||||
x.Name != null && x.Name.Contains($"{year}/{monthCopy:D2}-{source.Desc1}-T")
|
||||
)
|
||||
.Include(x => x.Records)
|
||||
.AsNoTracking()
|
||||
.FirstOrDefault();
|
||||
if (dataSource != null)
|
||||
{
|
||||
@@ -148,6 +149,7 @@ public class T4R2Processor(
|
||||
x.Name != null && x.Name.Contains($"{year}/13-{source.Desc1}-T")
|
||||
)
|
||||
.Include(x => x.Records)
|
||||
.AsNoTracking()
|
||||
.FirstOrDefault();
|
||||
if (dataSourceSum != null)
|
||||
{
|
||||
@@ -216,6 +218,7 @@ public class T4R2Processor(
|
||||
var r2 = db.Layers
|
||||
.Where(x => x.Id == sourceId)
|
||||
.Include(x => x.Records)
|
||||
.AsNoTracking()
|
||||
.FirstOrDefault();
|
||||
|
||||
const int startRow = 6;
|
||||
|
||||
@@ -53,6 +53,7 @@ public class T5LastValuesProcessor(
|
||||
.Where(x => x.ParentId == sourceImportWorker.Id
|
||||
&& !x.IsDeleted)
|
||||
.OrderByDescending(x => x.CreatedAt)
|
||||
.AsNoTracking()
|
||||
.ToList();
|
||||
|
||||
if (dataSources.Count == 0) throw new Exception($"DataSource is empty, {sourceImportWorker.Name}");
|
||||
|
||||
Reference in New Issue
Block a user