using System.Linq.Expressions;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Query;
using SVSim.Database.Models;
namespace SVSim.Database.Services.Inventory;
///
/// Caller-supplied extra .Include chains on top of the canonical viewer-inventory query
/// in . Use to bring in extra collections needed by
/// the calling controller (e.g. MissionData, BuildDeckPurchases).
///
public sealed class InventoryLoadConfig
{
internal List, IQueryable>> Includes { get; } = new();
public InventoryLoadConfig WithInclude(
Expression> path)
{
Includes.Add(q => q.Include(path));
return this;
}
public InventoryLoadConfig WithInclude(
Expression>> collectionPath,
Expression> thenPath)
{
Includes.Add(q => q.Include(collectionPath).ThenInclude(thenPath));
return this;
}
}