Help with Dialect file in NHibernate
I have begun creating a dialect for Interbase 7 in NHibern开发者_运维百科ate.
Interbase SQL includes an operator CONTAINING 'foo'
which is the equivalent of LIKE '%' + 'foo' + '%'
in other flavours of SQL. LIKE
is case sensitive in Interbase whereas CONTAINING
is not, so I would like the dialect to translate LIKE
situations to use CONTAINING
instead.
I've had a really good look at example dialect files but I can't find anything relevant there. Can anyone provide any pointers?
There's no way to replace internal uses of LIKE with CONTAINING (except patching NH).
You need to call CONTAINING explicitly. Once you've registered it, it's available as just another function in HQL, using Projections.SQLFunction in Criteria, and by writing the corresponding generator in LINQ (see http://fabiomaulo.blogspot.com/2010/07/nhibernate-linq-provider-extension.html)
You can use 'UPPER' to convert both side of the strings to Upper Case.
http://www.ibprovider.com/forum/site/viewtopic.php?f=3&t=24
精彩评论