I am getting this error, i am trying to resolve it long but unable to fix it.
LINQ to Entities does not recognize the method 'System.Object Parse(System.Type, System.String)' method, and this method cannot be translated into a store expression.
public static List<itmCustomization> GetAllProductCustomziation(string catID)
{
var arrcatID = catID.Split('_');
int PId = int.Parse(arrcatID[0].ToString());
int CatID = int.Parse(arrcatID[1].ToString());
EposWebOrderEntities db = new EposWebOrderEntities();
List<itmCustomization> lstCust = new List<itmCustomization>();
lstCust.AddRange((from xx in db.vw_AllCustomization
where xx.CatID == CatID && xx.ProductID == PID
select new itmCustomization()
{
itmName = xx.Description,
catId = (int)xx.CatID,
proId = (int)xx.ProductID,
custType = (customizationType)Enum.Parse(typeof(customizationType), xx.CustType)
}).ToList<itmCustomization>());
return lstCust;
}
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…