Is it possible to use table t-sql table-valued user-defined function as part of HQL query ?
here Nhibernate filtering by user defined function output is a example how to create custom dialect extention but in this example scalar UDF is used.
Let's assume that I have following t-sql UDT
CREATE FUNCTION [dbo].[getSuitableProjects]
(
@userID INT
)
RETURNS @result TABLE
(
ProjectID INT
)
AS
-- body of the function ..
I would like to be able to write following hql - second line is pseudocode, simply I would like to invoke my function as part of hql query - real query is more complicated it has fetch joins etc.
StringBuilder hql = new StringBuilder();
hql.AppendLine("select p from Projects p WHERE p.ProjectID IN");
hql.AppendLine("(run with parameter -> getSuitableProjects(:userID))");
IQuery q = UOW.Session.CreateQuery(hql.ToString());
q.SetInt32("userID", userID);
I spend some time looking for answer but without results. Is it possible ?
Thank You in Advance.