Optimize ShippingDocuments query order
Reordered LINQ method calls to filter ShippingDocuments by foreign keys before loading related PartnerDepot entities. This change ensures only relevant related data is loaded, improving query performance without altering logic.
This commit is contained in:
parent
4081bddfcc
commit
1236fb523d
|
|
@ -390,8 +390,8 @@ namespace Nop.Plugin.Misc.FruitBankPlugin.Controllers
|
||||||
// Bejövő: a csoport ÖSSZES szállítólevele EGY tradeCard-dá (összevont tömeg/érték); GetAll(true) = teljes gráf.
|
// Bejövő: a csoport ÖSSZES szállítólevele EGY tradeCard-dá (összevont tömeg/érték); GetAll(true) = teljes gráf.
|
||||||
// A PartnerDepot szándékosan NINCS a default loadRelations-ben — csak itt kell (felrakodási hely = depot címe).
|
// A PartnerDepot szándékosan NINCS a default loadRelations-ben — csak itt kell (felrakodási hely = depot címe).
|
||||||
var documents = await ctx.ShippingDocuments.GetAll(true)
|
var documents = await ctx.ShippingDocuments.GetAll(true)
|
||||||
.LoadWith(sd => sd.PartnerDepot)
|
.Where(sd => foreignKeys.Contains(sd.Id))
|
||||||
.Where(sd => foreignKeys.Contains(sd.Id)).ToListAsync();
|
.LoadWith(sd => sd.PartnerDepot).ToListAsync();
|
||||||
if (documents.Count == 0) throw new InvalidOperationException($"EkaerHistory #{ekaerHistoryId}: no ShippingDocuments found for the mapped ids.");
|
if (documents.Count == 0) throw new InvalidOperationException($"EkaerHistory #{ekaerHistoryId}: no ShippingDocuments found for the mapped ids.");
|
||||||
ekaerHistory = fruitBankEkaerService.GenerateEkaerXmlDocument(documents, ekaerHistory);
|
ekaerHistory = fruitBankEkaerService.GenerateEkaerXmlDocument(documents, ekaerHistory);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue