How can I produce this query using NHibernate.Linq?
WHERE this_.Name LIKE @p0; @p0 = \'test\' // Notice NO % wild card
Note, this is not Linq
With NH 4 (and probably a bit earlier), a built-in Like
string extension is available within NHibernate.Linq
namespace: Like(this string matchExpression, string sqlLikePattern)
. (It is defined on NHibernate.Linq.SqlMethods extension class.)
using NHibernate.Linq;
...
session.Query()
.Where(t => t.Name.Like("test"));