我有一塊代碼在Epicor10中轉換爲C#。 板載編譯器允許使用此代碼,但是當它從API中被觸發時,我會收到:LINQ to Entities無法識別方法'System.Object get_Item(System.String)'Epicor10
LINQ to Entities不能識別方法System.Object get_Item(System.String)方法,並且此方法不能被翻譯成商店表達。
我把它縮小到我的where子句中的這一部分:
&& string.Compare((string)Part_Row["ShortChar01"] ,(string)"None",true)!=0
正是這個片段的一部分:關於如何解決
var ttRcvDtlRow = ttRcvDtl_iterator;
foreach (var Part_iterator in (from Part_Row in Db.Part
where string.Compare(Part_Row.Company, ttRcvDtlRow.Company, true) == 0
&& string.Compare(Part_Row.PartNum, ttRcvDtlRow.PartNum, true) == 0
/*&& string.Compare((string)Part_Row["ShortChar01"] ,"None",true)!=0*/
&& string.Compare((string)Part_Row["ShortChar01"] ,(string)"None",true)!=0
select Part_Row))
建議。我從其他帖子瞭解到,發生這種情況B/C LINQ發送到SQL,並在翻譯(或類似的)有問題
索引?
Erp.Tables.Part Part;
foreach (var ttRcvDtl_iterator in (from ttRcvDtl_Row in ttRcvDtl
where (string.Equals(ttRcvDtl_Row.RowMod, IceRow.ROWSTATE_ADDED, StringComparison.OrdinalIgnoreCase) || string.Equals(ttRcvDtl_Row.RowMod, IceRow.ROWSTATE_UPDATED, StringComparison.OrdinalIgnoreCase))
&& String.IsNullOrEmpty(ttRcvDtl_Row.LotNum)
select ttRcvDtl_Row))
感謝, JM
Part_Row的類型是什麼?你能顯示索引器的代碼嗎?必須有方法將其重寫到'FirstOrDefault(表達式)'中。 –
請編輯問題。評論中的代碼很難閱讀。 –
對不起,新的。 – JMar