I have made a custom dialect to be able to use NHibernate with a Progress/OpenEdge database over ODBC. In most cases the dialect works fine, but I have a problem with SELECT TOP statements. The problem is that the statements are generated as the following with the amount of columns to return as a parameter:
SELECT TOP ? SomeColumn
FROM SomeTable
where SomeColumn = ?; p0 = 100, p1 = 'test'
The Progress/Openedge database does not support this, so I would like to make some changes to the dialect, forcing the statement to not use parameters for the amount of columns in SELECT TOP - like this:
SELECT TOP 100 SomeColumn
FROM SomeTable
where SomeColumn = ?; p0 = 'test'
Is this possible?
By the way, im using NHibernate v. 3.3.1
By looking at NHibernate's source code, I would say that you need to override SupportsVariableLimit
property to return false
.
/// <summary>
/// Can parameters be used for a statement containing a LIMIT?
/// </summary>
public override bool SupportsVariableLimit
{
get { return false; }
}
Edit
Unfortunately, it seems that NHibernate Linq doesn't use SupportsVariableLimit
property. It always tries to use parameters.
Here's a discussion on that, with a source code fix.