E10 - LINQ to Entities does not recognize the method 'System.Object get_Item(System.String)'


Converting a method directive (Customer.Update) from ABL to C# using the conversion tool. The code compiles but there are errors at runtime. I have narrowed the problem down to the “foreach” statement below. When I remove that section the rest of the code runs.

BPM runtime caught an unexpected exception of ‘NotSupportedException’ type.
See more info in the Inner Exception section of Exception Details.

Part of the error description:
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.

Erp.Tables.Customer Customer;
foreach (var Customer_xRow in (from Customer_Row in Db.Customer
where Customer_Row.Company == ttCustomer_xRow.Company && (decimal)Customer_Row[“Number01”] >= 35000 && (decimal)Customer_Row[“Number01”] <= 99999
select Customer_Row))

Most of the searches I find on this refer to casting but that part looks correct to me.


Bill Short

Generally it is recommended you use the converter tool as a “guide” but don’t use the code it spits out directly. It is inefficient and sometimes just plain wrong.
Can you paste your original ABL?


I have been starting with the converter and have had to modify everything that it kicks out.

Here is the piece of code from ABL:

For each Customer where Customer.Company = ttCustomer.Company and
Customer.Number01 >= 35000 and
Customer.Number01 <= 99999 no-lock
by Customer.Number01 descending.

Thanks for the help.


What is the solution?

To which? The exact LINQ Statement?

Thanks for the reply Bart,
I got the solution, I was referring the column like tttable[“Column”],
I changed it to tttable.Column and it was solved.