perf(templateengine): alarm-override, folder-delete and template-delete checks read lean template projections (review 2026-10-21 04/P6, 08/P1)
InstanceService.SetAlarmOverrideAsync and TemplateDeletionService move to the no-tracking, body-free GetAllTemplatesForAnalysisAsync; TemplateFolderService counts folder contents from GetTemplateStubsAsync.
This commit is contained in:
@@ -53,7 +53,10 @@ public class TemplateDeletionService
|
||||
}
|
||||
|
||||
// Check 2: Child templates reference it as parent. Split derived vs. regular.
|
||||
var allTemplates = await _repository.GetAllTemplatesAsync(cancellationToken);
|
||||
// Reads ids, names, parent/derived/owner edges and composition rows only — the
|
||||
// no-tracking, script-body-free analysis projection carries all of them
|
||||
// (review 2026-10-21 04/P6, 08/P1).
|
||||
var allTemplates = await _repository.GetAllTemplatesForAnalysisAsync(cancellationToken);
|
||||
var inheritors = allTemplates.Where(t => t.ParentTemplateId == templateId).ToList();
|
||||
var regularChildren = inheritors.Where(t => !t.IsDerived).ToList();
|
||||
var derivatives = inheritors.Where(t => t.IsDerived).ToList();
|
||||
@@ -79,7 +82,7 @@ public class TemplateDeletionService
|
||||
}
|
||||
|
||||
// Check 3: Other templates compose it directly.
|
||||
// Read the Compositions navigation already loaded by GetAllTemplatesAsync
|
||||
// Read the Compositions navigation already loaded by GetAllTemplatesForAnalysisAsync
|
||||
// rather than issuing one GetCompositionsByTemplateIdAsync round-trip per
|
||||
// template — this is the same source TemplateService
|
||||
// .DeleteTemplateAsync uses for the equivalent check.
|
||||
|
||||
Reference in New Issue
Block a user