diff --git a/src/NHibernate/Linq/Functions/MathGenerator.cs b/src/NHibernate/Linq/Functions/MathGenerator.cs index 5f8351f1f3c..990ea27e0df 100644 --- a/src/NHibernate/Linq/Functions/MathGenerator.cs +++ b/src/NHibernate/Linq/Functions/MathGenerator.cs @@ -80,16 +80,52 @@ public MathGenerator() ReflectHelper.FastGetMethod(MathF.Ceiling, default(float)), ReflectHelper.FastGetMethod(MathF.Pow, default(float), default(float)), +#endif +#if NET8_0_OR_GREATER + ReflectHelper.FastGetMethod(float.Sin, default(float)), + ReflectHelper.FastGetMethod(float.Cos, default(float)), + ReflectHelper.FastGetMethod(float.Tan, default(float)), + ReflectHelper.FastGetMethod(float.Sinh, default(float)), + ReflectHelper.FastGetMethod(float.Cosh, default(float)), + ReflectHelper.FastGetMethod(float.Tanh, default(float)), + ReflectHelper.FastGetMethod(float.Asin, default(float)), + ReflectHelper.FastGetMethod(float.Acos, default(float)), + ReflectHelper.FastGetMethod(float.Atan, default(float)), + ReflectHelper.FastGetMethod(float.Atan2, default(float), default(float)), + ReflectHelper.FastGetMethod(float.Sqrt, default(float)), + ReflectHelper.FastGetMethod(float.Abs, default(float)), + ReflectHelper.FastGetMethod(float.Sign, default(float)), + ReflectHelper.FastGetMethod(float.Floor, default(float)), + ReflectHelper.FastGetMethod(float.Ceiling, default(float)), + ReflectHelper.FastGetMethod(float.Pow, default(float), default(float)), + + ReflectHelper.FastGetMethod(double.Sin, default(double)), + ReflectHelper.FastGetMethod(double.Cos, default(double)), + ReflectHelper.FastGetMethod(double.Tan, default(double)), + ReflectHelper.FastGetMethod(double.Sinh, default(double)), + ReflectHelper.FastGetMethod(double.Cosh, default(double)), + ReflectHelper.FastGetMethod(double.Tanh, default(double)), + ReflectHelper.FastGetMethod(double.Asin, default(double)), + ReflectHelper.FastGetMethod(double.Acos, default(double)), + ReflectHelper.FastGetMethod(double.Atan, default(double)), + ReflectHelper.FastGetMethod(double.Atan2, default(double), default(double)), + ReflectHelper.FastGetMethod(double.Sqrt, default(double)), + ReflectHelper.FastGetMethod(double.Abs, default(double)), + ReflectHelper.FastGetMethod(double.Sign, default(double)), + ReflectHelper.FastGetMethod(double.Floor, default(double)), + ReflectHelper.FastGetMethod(double.Ceiling, default(double)), + ReflectHelper.FastGetMethod(double.Pow, default(double), default(double)), #endif }; } public override HqlTreeNode BuildHql(MethodInfo method, Expression expression, ReadOnlyCollection arguments, HqlTreeBuilder treeBuilder, IHqlExpressionVisitor visitor) { - string function = method.Name.ToLowerInvariant(); - - if (function == "pow") - function = "power"; + var function = method.Name.ToLowerInvariant() switch + { + "pow" => "power", + var f => f, + }; var firstArgument = visitor.Visit(arguments[0]).AsExpression(); diff --git a/src/NHibernate/Linq/Functions/RoundGenerator.cs b/src/NHibernate/Linq/Functions/RoundGenerator.cs index ec349b157d8..b5d82f6cc87 100644 --- a/src/NHibernate/Linq/Functions/RoundGenerator.cs +++ b/src/NHibernate/Linq/Functions/RoundGenerator.cs @@ -25,6 +25,13 @@ public RoundGenerator() ReflectHelper.FastGetMethod(MathF.Round, default(float)), ReflectHelper.FastGetMethod(MathF.Round, default(float), default(int)), #endif + +#if NET8_0_OR_GREATER + ReflectHelper.FastGetMethod(float.Round, default(float)), + ReflectHelper.FastGetMethod(float.Round, default(float), default(int)), + ReflectHelper.FastGetMethod(double.Round, default(double)), + ReflectHelper.FastGetMethod(double.Round, default(double), default(int)), +#endif }; } diff --git a/src/NHibernate/Linq/Functions/TruncateGenerator.cs b/src/NHibernate/Linq/Functions/TruncateGenerator.cs index d2f646f6ebd..ba404cdb9b2 100644 --- a/src/NHibernate/Linq/Functions/TruncateGenerator.cs +++ b/src/NHibernate/Linq/Functions/TruncateGenerator.cs @@ -20,6 +20,10 @@ public TruncateGenerator() #if NETCOREAPP2_0_OR_GREATER || NETSTANDARD2_1_OR_GREATER ReflectHelper.FastGetMethod(MathF.Truncate, default(float)), +#endif +#if NET8_0_OR_GREATER + ReflectHelper.FastGetMethod(float.Truncate, default(float)), + ReflectHelper.FastGetMethod(double.Truncate, default(double)), #endif }; }