feat(inventory): scaffold InventoryService namespace types
Empty interfaces + records for IInventoryService, IInventoryTransaction, InventoryCommitResult, InventoryLoadConfig, InventoryCatalogException. Implementation lands in subsequent commits. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
31
SVSim.Database/Services/Inventory/InventoryLoadConfig.cs
Normal file
31
SVSim.Database/Services/Inventory/InventoryLoadConfig.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
using System.Linq.Expressions;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Query;
|
||||
using SVSim.Database.Models;
|
||||
|
||||
namespace SVSim.Database.Services.Inventory;
|
||||
|
||||
/// <summary>
|
||||
/// Caller-supplied extra <c>.Include</c> chains on top of the canonical viewer-inventory query
|
||||
/// in <see cref="IInventoryService.BeginAsync"/>. Use to bring in extra collections needed by
|
||||
/// the calling controller (e.g. <c>MissionData</c>, <c>BuildDeckPurchases</c>).
|
||||
/// </summary>
|
||||
public sealed class InventoryLoadConfig
|
||||
{
|
||||
internal List<Func<IQueryable<Viewer>, IQueryable<Viewer>>> Includes { get; } = new();
|
||||
|
||||
public InventoryLoadConfig WithInclude<TProperty>(
|
||||
Expression<Func<Viewer, TProperty>> path)
|
||||
{
|
||||
Includes.Add(q => q.Include(path));
|
||||
return this;
|
||||
}
|
||||
|
||||
public InventoryLoadConfig WithInclude<TProperty, TThen>(
|
||||
Expression<Func<Viewer, IEnumerable<TProperty>>> collectionPath,
|
||||
Expression<Func<TProperty, TThen>> thenPath)
|
||||
{
|
||||
Includes.Add(q => q.Include(collectionPath).ThenInclude(thenPath));
|
||||
return this;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user