Probably I'm blind, but I can't find how to convert string to int. I wrote
query.OrderByDescending(a => SqlFunctions.IsNumeric(
a.Index.Substring(a.Index.Length - 4, 4)) == 1 ?
Convert.ToInt32(a.Index.Substring(a.Index.Length - 4, 4)) :
0);
But, as I suspected, it returns an error
LINQ to Entities does not recognize the method 'Int32 ToInt32(System.String)'
Moreover SqlFunctions don't have a member Convert. Is any way to achieve this without enumerating the query?
EDIT:
int.Parse
throws
LINQ to Entities does not recognize the method 'Int32 Parse(System.String)