Thank! It was
LINQ to Entities does not recognize the method ‘System.String get_Item(System.String)’ method, and this method cannot be translated into a store expression.
Thank! It was
LINQ to Entities does not recognize the method ‘System.String get_Item(System.String)’ method, and this method cannot be translated into a store expression.
Interesting. It is going to take me a while to digest. ChatGPT also recommended StringBuilder.
Ohhh it doesn’t like your dictionary lookup within the linq query.
If you replace
if (!string.IsNullOrEmpty(pkColl["Fit"]))
{
udPartDesc = Db.UDCodes.Select(ud => ud.CodeTypeID == "Fit" && ud.CodeID == pkColl["Fit"]).ToString();
partDesc = udPartDesc;
}
with
if (!string.IsNullOrEmpty(pkColl["Fit"]))
{
string dictValue = pcColl["Fit"];
udPartDesc = Db.UDCodes.Select(ud => ud.CodeTypeID == "Fit" && ud.CodeID == dictValue).ToString();
partDesc = udPartDesc;
}
That should solve your error.
That “LINQ to Entities” always catches me off guard.