title: varchar(max) + linq to sql
body: <p>I've got a varchar(max) column I'm trying to read but the field is being truncated at 4,000 characters.  I've seen <a href="https://stackoverflow.com/questions/2502734/my-varcharmax-field-is-capping-itself-at-4000-what-gives">similar questions</a>, but they are on the sql side.</p>
  
  <p>What do I need to do to get the entire field?</p>
  
  <p>Eg:</p>
  
  <pre><code>using (DataContext dc = new DataContext())
  {
      var foo = dc.foos.First();
      if (foo.Formula2.Length &gt; 4000)
      {
          Console.WriteLine("success!");
      }
  }
  </code></pre>
  
  <p>I've tried things like <a href="http://msdn.microsoft.com/en-us/library/ms186238.aspx" rel="nofollow noreferrer">setting TextSize</a> but it didn't make a difference.:</p>
  
  <pre><code>dc.ExecuteCommand("SET TEXTSIZE 100000;");
  var foo = dc.foos.First();
  </code></pre>
  
  <p><strong>UPDATE:</strong></p>
  
  <p>The server data type is varchar(max).  The field in question is formula2:
  <img src="https://i.stack.imgur.com/AxlBr.png" alt="alt text"></p>
  
  <p>If I try and change the type to something different like Object, I get message '<em>Mapping between DbType 'VarChar(MAX)' and Type 'System.Object' in Column 'Formula2' of Type 't_PriceFormula' is not supported.</em>'</p>
  
  <p>Any suggestions?</p>