Nhibernate LinqExtensionMethod .Net C#

I want to use a Scalar-Value Function inside my Query with Nhibernate, I will first write all versions & technology I use:
Language. .Net C#
Technology Asp.Net MVC
Framework 4.7.2
NHibernate version 5.2.6
FluentNHibernate 2.1.2
NHibernate.Mapping.Attributes 5.1.0
BhibernateProfiler 5.0.5028

I have a scalar function in my database that I assure you it is working named FUNCTION [dbo].[CalculateNumPrev_TstPrev](
Anno int, --Anno
Anno_Prev int, --Anno
offerNumber int, --Numprev
offerRevision INT --Revisione

(I removed @ )

I added a LinqExtensionMethod like this

        public static string CalculateNumPrev_TstPrev(this int Anno, int Anno_Prev, int offerNumber, int offerRevision)
            // No need to implement it in .Net, unless you wish to call it
            // outside IQueryable context too.
            throw new NotImplementedException("This call should be translated " +
                "to SQL and run db side, but it has been run with .Net runtime");

and I use this call ( of course inside IQueryable )

queryResult.Select(x => new TstPrevGridModel
                    Numprev = CustomLinqExtensions.CalculateNumPrev_TstPrev(x.Anno, x.Annoprev, x.Numprev, x.Revisione),
                    OfferId = x.Id

I assure you even If I change the call in x.Anno.CalculateNumPrev_TstPrev( x.Annoprev, x.Numprev, x.Revisione) It’ll throw the same error… What I miss, please help me, I’m desperate.

It seems that Nhibernate could not transform the query correctly and call my Function.


No data type for node: MethodNode ( method dbo.CalculateNumPrev_TstPrev ( expr_list ( tstprev0_.Anno tstprev0_.idx1 Anno ) ( tstprev0_.Annoprev tstprev0_.idx1 Annoprev ) ( tstprev0_.Numprev tstprev0_.idx1 Numprev ) ( tstprev0_.Revisione tstprev0_.idx1 Revisione ) ) )

This is the forum for Hibernate, the Java ORM. Here is the proper place for asking questions about NHibernate: https://groups.google.com/g/nhusers