title: Entity Framework v4.1 LIKE
body: <p>How do I have to build my query to result in an output SQL query like:</p>
  
  <pre><code>SELECT
  [viewRegisters].[Id] AS [IdRegister]
  WHERE Name LIKE '%a%bc'
  </code></pre>
  
  <p>OR</p>
  
  <pre><code>SELECT
  [viewRegisters].[Id] AS [IdRegister]
  WHERE Name LIKE 'a%b%c'
  </code></pre>
  
  <p>OR</p>
  
  <pre><code>SELECT
  [viewRegisters].[Id] AS [IdRegister]
  WHERE Name LIKE 'a%b%c%'
  </code></pre>
  
  <p>I'm using .Net Framework 4.0, Entity Framework v4.1 and C#.</p>
  
  <p>EF v4.1 converts this type of linq queries from:</p>
  
  <pre><code>((IQueryable&lt;T&gt;)Data).Where(z =&gt; z.Field.Contains("a%b%c%"));
  </code></pre>
  
  <p>Into:</p>
  
  <pre><code>SELECT
  [viewRegisters].[Id] AS [Id]
  WHERE Name LIKE N'a~%b~%c~%' ESCAPE N'~'
  </code></pre>
  
  <p>That's not what I want. I want to be able to use the 'percent' symbol as I do directly in DB.</p>