Как конвертировать строку в int, используя LINQ и лямбда выражения
<pre>var cat = dbContext.MainCategories.SingleOrDefault(x => x.MainCategoryId == Convert.ToInt32(MainCategoryId));
Это дает ошибку
LINQ to Entities does not recognize the method 'Int32 ToInt32(System.String)' method, and this method cannot be translated into a store expression.
Что я уже пробовал:
<pre>var cat = dbContext.MainCategories.SingleOrDefault(x => x.MainCategoryId == Convert.ToInt32(MainCategoryId));