I'm building my own "HQL Query Analyzer" and an HqlObjectDataSource class and corresponding designer for use in Visual Studio. So, given an arbitrary HQL query string, I would like to determine the names and types of the query parameters. E.g. if my query string is
Code:
SELECT ...
FROM SomeEntity e
WHERE e.Property1 = :foo
AND e.Property2 = :bar
I would like to call some NHibernate method that returns an instance of NHibernate.Engine.QueryParameters that defines "foo" and "bar". In the returned QueryParameters.NamedParameters, the Value in each NHibernate.Engine.TypedValue would be a uninitialized (or otherwise meaningless), but that's fine, all I care about is getting the Name and Type properties for each parameter.
Internally, NHibernate needs to determine this parameter information when it executes queries. The question is, does NHibernate properly break out this parsing task to an API method I can call? And if so, what is that call? I'm looking in the NHibernate.Hql namespace, and see a QueryTranslator object which takes a query string. I also see various Parser classes in this namespace. However, nothing jumps out at me as the method or property to call to get this query parameter information for a given query string ...