title: Nhibernate escaping special character within linq query
body: <p>I have a table like:</p>
  
  <p><strong>TABLE_XY</strong></p>
  
  <pre><code>|ID |SOURCE|
  |1  |value_aa|
  |2  |other_aa|
  |3  |eeeaa|  
  </code></pre>
  
  <p>And the generated query should be:</p>
  
  <pre><code>select * from TABLE_XY where SOURCE like '%\_aa' ESCAPE '\'​
  </code></pre>
  
  <p>I know that there are two options which would fit my needs</p>
  
  <pre><code>var result = 
              session.QueryOver&lt;TableXy&gt;()
              .WhereRestrictionOn(x =&gt; x.Source)
              .IsLike("%\_aa", MatchMode.Exact, '\\')
              .List();
  </code></pre>
  
  <p>or </p>
  
  <pre><code>var result2 = session
       .CreateCriteria&lt;TableXy&gt;()
       .Add(LikeExpression("Source", "%\\_aa", MatchMode.Exact, '\\', false))
       .List(); 
  </code></pre>
  
  <p>But I have to use a Linq based implementation. I'm working with dynamically created expression trees, which sometimes will be executed with the Linq to Object Provider or Linq to Nhibernate. 
  But currently only this method is supported:</p>
  
  <pre><code>  var result = session
         .Query&lt;TableXy&gt;()
         .Where(x =&gt; NHibernate.Linq.SqlMethods.Like(x.Source, "%\\_aa"))
         .ToList();
  </code></pre>
  
  <p>How can I extend the Nhibernate Linq Provider to support?</p>
  
  <pre><code>SqlMethods.IsLike(string source, string pattern, char? escape);
  </code></pre>