-
Notifications
You must be signed in to change notification settings - Fork 0
Closed
Labels
enhancementNew feature or requestNew feature or requestin-progressWork currently in progressWork currently in progress
Description
背景
PR #140 實作了基礎 Lookup Cache 功能。根據 BMS 實際整合回饋,需要以下改善:
改善項目
P0: 多 DbContext 來源 (#2)
Wtm.GetLookup<T>() 目前只能查 Wtm.DC(主庫)。BMS 有 DataContext_Orss(ORSS 唯讀庫),Holiday_Orss 等參照表無法使用。
方案:在 [CacheLookup] 加 ContextType 可選參數:
```csharp
[CacheLookup(TtlMinutes = 60, ContextType = typeof(DataContext_Orss))]
public class Holiday_Orss : BasePoco { ... }
```
P1: IReadOnlyList 回傳型別 (#9)
目前回傳 List<T>,呼叫端可能誤修改快取物件造成資料汙染。改為 IReadOnlyList<T>。
P1: by-ID 快速查找 (#4)
加入 GetLookupItem<T>(Func<T, bool>) 或 GetLookupItem<T>(Guid id) 單筆 API。
P1: GetLookupSelectList 整合 (#5)
提供下拉選單整合 API:
```csharp
var items = Wtm.GetLookupSelectList(
valueField: x => x.ID,
textField: x => x.CurrenyName,
filter: x => x.IsEnable == true
);
```
P2: 全域 TenantIsolation 開關 (#13)
單租戶系統不想每張表都加 TenantIsolation = false,提供全域預設值。
文件補充
- Stampede 防護說明(已知取捨:
GetOrCreate非原子,併發 miss 安全但可能多查) - filter 參數語義(
Func<T, bool>in-memory 過濾,不回 DB) - EmptyContext 不觸發自動失效
測試
- 所有新 API 需 MSTest 覆蓋
- 確認既有 22 個 Cache 測試不受影響
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requestin-progressWork currently in progressWork currently in progress