using System.Linq; using YLErp.DBModels; namespace YLErp.Modules.SwapModule { /// /// swap_position 查询收口(Query Object)。 /// 规则"有效持仓 = SwapTradeId 匹配且未作废(!Invalid)"集中于此, /// 避免多处复制同一谓词导致语义漂移(漏写 !Invalid 即静默出 bug)。 /// 仅返回 IQueryable,不调用 SaveChanges,不破坏跟踪/Include/事务边界。 /// public static class SwapPositionQueries { public static IQueryable ActiveByTrade( this IQueryable query, int tradeId) => query.Where(x => x.SwapTradeId == tradeId && !x.Invalid); } }