Missed registration of Concat function for SQLCE4

Description

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

Environment

None

Activity

Fabio Maulo 
July 30, 2011 at 2:11 PM

Closed after final release of NH3.2.0GA

Fixed

Details

Assignee

Reporter

Components

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
Who's Looking?