jjzjj

c# - LINQ to Entities 仅支持使用 IEntity 接口(interface)转换 EDM 原语或枚举类型

我有以下通用扩展方法:publicstaticTGetById(thisIQueryablecollection,Guidid)whereT:IEntity{Expression>predicate=e=>e.Id==id;Tentity;//Allowreportingmoredescriptiveerrormessages.try{entity=collection.SingleOrDefault(predicate);}catch(Exceptionex){thrownewInvalidOperationException(string.Format("Therewasanerr

c# - LINQ to Entities 仅支持使用 IEntity 接口(interface)转换 EDM 原语或枚举类型

我有以下通用扩展方法:publicstaticTGetById(thisIQueryablecollection,Guidid)whereT:IEntity{Expression>predicate=e=>e.Id==id;Tentity;//Allowreportingmoredescriptiveerrormessages.try{entity=collection.SingleOrDefault(predicate);}catch(Exceptionex){thrownewInvalidOperationException(string.Format("Therewasanerr