1
我想從整個EF中的MSSQL數據庫獲取數據。無法創建類型Linq錯誤的常量值
請參見下面的代碼:
model.events =
_FoxDB.DWH_EventsBasicData.Where(
e => e.Event_StartTime >= model.StartDate && e.Event_EndTime <= model.EndDate).ToList();
model.Tps = _FoxDB.DWH_TrainingProgramsBasicData.Where(
t => model.events.Any(e => e.EventTrainingProgram_ID.Equals(t.TrainingProgramID))).Select(t => new EntityDropDown()
{
ID = t.TrainingProgramID,
Name = t.TrainingProgramName
}).ToList();
在第一行中我得到的事件列表>那部分工作得很好,我也把它轉換成ToList
所以它會在本地運行。
比我想獲得的事件集合中存在的培訓計劃列表。
我讀了很少有關這個錯誤和文章的答案,我仍然不明白這個問題。
錯誤:Unable to create a constant value of type 'FoxConcept.Models.DALModels.DWH_EventBasicData'. Only primitive types or enumeration types are supported in this context
任何幫助表示讚賞。