36 lines
1.2 KiB
C#
36 lines
1.2 KiB
C#
using Newtonsoft.Json;
|
||
using System;
|
||
using System.Collections.Generic;
|
||
using System.ComponentModel;
|
||
using System.ComponentModel.DataAnnotations;
|
||
using System.Globalization;
|
||
using System.Linq;
|
||
using System.Reflection;
|
||
using System.Reflection.Emit;
|
||
using System.Runtime.Serialization;
|
||
using System.Web.Http;
|
||
|
||
namespace Model
|
||
{
|
||
// 為對應資料表MODEL宣告額外參數類別(Metadata)
|
||
// [JsonIgnore] 避免WEBAPI自動抓關聯資料
|
||
[MetadataType(typeof(filesMetadata))]
|
||
public partial class file
|
||
{
|
||
private class filesMetadata
|
||
{
|
||
[JsonIgnore]
|
||
public virtual ICollection<actItem_files> actItem_files { get; set; }
|
||
|
||
}
|
||
// TODO: CRITICAL - 靜態字段設計問題(同 follower.cs)
|
||
// 權衡:AsEnumerable() vs ToList()
|
||
// - AsEnumerable(): 不立即佔內存,但 DbContext 未 Dispose(有風險)
|
||
// - ToList(): 立即載入所有 files 到內存(可能很大)且數據過時
|
||
// 建議:改為實例方法或使用緩存機制
|
||
// 暫時保留 AsEnumerable() 避免立即載入大量數據
|
||
public static IEnumerable<Model.file> allFiles = new Model.ezEntities().files.AsEnumerable();
|
||
}
|
||
}
|
||
|