I have piece of code converted to C# in Epicor10. The on board compiler allows for this code, but when it is triggered from the API I receive:
LINQ to Entities does not recognize the method 'System.Object get_Item(System.String)' method, and this method cannot be translated into a store expression.
I have it narrowed down to this part of my where clause:
&& string.Compare((string)Part_Row["ShortChar01"] ,(string)"None",true)!=0
it is part of this snippet:
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))
Suggestions on how to fix. I understand from other posts that this happens b/c linq is sending this to SQL and there is a problem in the translating (or something similar)
Indexer?
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))
Thanks, JM
Part_Row? And can you show the code of the indexer? There must be way to rewrite this into aFirstOrDefault(expression). - Gert ArnoldPart_Row["ShortChar01"]by the LINQ statement in the indexer. It's hard to piece together what your code looks like without seeing the class model. Next question would be, what isttRcvDtl? Etc. - Gert Arnold