Showing posts with label (from pt in fdb.PrintTypes wh. Show all posts
Showing posts with label (from pt in fdb.PrintTypes wh. Show all posts

LINQ to Entities does not recognize the method 'Int32 Parse(System.String)' why?



I have code



foreach (XElement t in selxml.Elements("Type"))
printxml.Add(new XElement("Type",
new XAttribute("TypeID", t.Attribute("ID").Value),
new XAttribute("TypeName", (from pt in fdb.PrintTypes where pt.PrintTypeID == Int32.Parse(t.Attribute("ID").Value) select pt.Name).SingleOrDefault()),
new XAttribute("Value", t.Attribute("Value").Value),
new XAttribute("ValueName", (from pti in fdb.PrintTypeItems
where pti.Value == Int32.Parse(t.Attribute("Value").Value) &&
pti.PrintTypeID == Int32.Parse(t.Attribute("ID").Value)
select pti.Name).SingleOrDefault())));


and VS say



LINQ to Entities does not recognize the method 'Int32 Parse(System.String)' method, and this method cannot be translated into a store expression.



why LINQ to Entities? this is Linq to XML. How can I solve this problem?


Read more ...