Fixed
Details
Details
Assignee
Unassigned
UnassignedReporter
Nathan Fisher
Nathan FisherComponents
Fix versions
Affects versions
Priority
Who's Looking?
Open Who's Looking?
Created March 21, 2011 at 2:46 PM
Updated July 30, 2011 at 2:11 PM
Resolved March 23, 2011 at 7:26 AM
see http://stackoverflow.com/questions/5371993/nhibernate-creating-unusual-sql-for-a-basic-query for details
Using both MsSqlCeDialect and the MsSqlCe40Dialect.
public IQueryable<Tag> GetTags(string tagName)
{
tagName = tagName ?? string.Empty;
return from tag in session.Query<Tag>()
where tag.Name.Contains(tagName)
select tag;
}
Results in the following query
select tag0_.Id as Id7_, tag0_.Name as Name7_ from "Tag" tag0_ where tag0_.Name like ('%'||@p0||'%')
To get around this, subclass the MsSqlCe[40]Dialectadd and add the following to the constructor
RegisterFunction("concat", new VarArgsSQLFunction(NHibernateUtil.String, "(", "+", ")"));
Credit goes to Diego Mijelshon for the workaround