title: Entity Framework compare string with integer
body: <p>I want to compare two values in Entity Framework. One of them is varchar in Database but the content is integer. 
  I've tried some methods( as in <a href="https://stackoverflow.com/questions/16694716/entity-framework-linq-expression-converting-from-string-to-int">Entity Framework/Linq EXpression converting from string to int</a> Convert.ToInt32 not supported in EF6)</p>
  
  <pre><code>.Where(r =&gt; Convert.ToInt32(r.foo.xxx)&gt;=yy)
  
  .Where(r =&gt; int.Parse(r.foo.xxx)&gt;=yy)
  </code></pre>
  
  <p>these parsing operations not supported in EF, </p>
  
  <pre><code>.Where(r =&gt; String.Compare(r.foo.xxx,yy)&gt;=0
  
  .Where(r =&gt; r.foo.xxx&gt;= SqlFunctions.StringConvert(yy))
  </code></pre>
  
  <p>and these operation compare two string values(7 >= 58 in string comparison)</p>
  
  <p>Is there anyway to compare these values in EF like Cast in MSSQL.</p>
  
  <p>Thx.</p>