I Use NHibernate 4.X + SQL Server for our ERP and we use HQL with where clause that contains unicode character.
My problem is searching for the unicode string.
For example:
select o.ID, o.Name
from MyClass o
where o.Name like '%محمدی%'
There are many records that match this condition, but HQL does not return any result.
The unicode character 'ی' causes this problem.
Then equivalent SQL has no result:
select o.ID, o.Name
from MyTable o
where o.Name like '%محمدی%'
But this SQL does return the correct results:
select o.ID, o.Name
from MyTable o
where o.Name like N'%محمدی%'
The N' before strings in HQL solves this problem.
My question is: how can we configure NHibernate to put N' prefix before generated SQL?