diff --git a/PanoramicData.NCalcExtensions/ExtendedExpression.cs b/PanoramicData.NCalcExtensions/ExtendedExpression.cs index 279ed7d..486c853 100644 --- a/PanoramicData.NCalcExtensions/ExtendedExpression.cs +++ b/PanoramicData.NCalcExtensions/ExtendedExpression.cs @@ -8,17 +8,18 @@ public class ExtendedExpression : Expression private readonly CultureInfo _cultureInfo; internal const string StorageDictionaryParameterName = "__storageDictionary"; - public ExtendedExpression(string expression) : this(expression, EvaluateOptions.None, CultureInfo.InvariantCulture) { } + public ExtendedExpression(string expression) : this(expression, ExpressionOptions.None, CultureInfo.InvariantCulture) { } public ExtendedExpression( string expression, - EvaluateOptions evaluateOptions, + ExpressionOptions evaluateOptions, CultureInfo cultureInfo) : base(expression, evaluateOptions, cultureInfo) { _cultureInfo = cultureInfo; Parameters[StorageDictionaryParameterName] = _storageDictionary; EvaluateFunction += Extend; - CacheEnabled = false; + Options |= ExpressionOptions.NoCache; + if (Parameters.ContainsKey("null")) { throw new InvalidOperationException("You may not set a parameter called 'null', as it is a reserved keyword."); diff --git a/PanoramicData.NCalcExtensions/Extensions/If.cs b/PanoramicData.NCalcExtensions/Extensions/If.cs index 5f2f335..b41c207 100644 --- a/PanoramicData.NCalcExtensions/Extensions/If.cs +++ b/PanoramicData.NCalcExtensions/Extensions/If.cs @@ -35,7 +35,7 @@ internal static void Evaluate(FunctionArgs functionArgs) } catch (Exception e) when (e is not NCalcExtensionsException or FormatException) { - throw new FormatException($"Could not evaluate {ExtensionFunction.If} function parameter 1 '{functionArgs.Parameters[0].ParsedExpression}'."); + throw new FormatException($"Could not evaluate {ExtensionFunction.If} function parameter 1 '{functionArgs.Parameters[0].LogicalExpression}'."); } if (boolParam1) @@ -47,7 +47,7 @@ internal static void Evaluate(FunctionArgs functionArgs) } catch (Exception e) when (e is not NCalcExtensionsException or FormatException) { - throw new FormatException($"Could not evaluate {ExtensionFunction.If} function parameter 2 '{functionArgs.Parameters[1].ParsedExpression}' due to {e.Message}.", e); + throw new FormatException($"Could not evaluate {ExtensionFunction.If} function parameter 2 '{functionArgs.Parameters[1].LogicalExpression}' due to {e.Message}.", e); } } @@ -57,7 +57,7 @@ internal static void Evaluate(FunctionArgs functionArgs) } catch (Exception e) when (e is not NCalcExtensionsException or FormatException) { - throw new FormatException($"Could not evaluate {ExtensionFunction.If} function parameter 3 '{functionArgs.Parameters[2].ParsedExpression}' due to {e.Message}.", e); + throw new FormatException($"Could not evaluate {ExtensionFunction.If} function parameter 3 '{functionArgs.Parameters[2].LogicalExpression}' due to {e.Message}.", e); } } } diff --git a/PanoramicData.NCalcExtensions/Extensions/Switch.cs b/PanoramicData.NCalcExtensions/Extensions/Switch.cs index e0bda79..40d6bb7 100644 --- a/PanoramicData.NCalcExtensions/Extensions/Switch.cs +++ b/PanoramicData.NCalcExtensions/Extensions/Switch.cs @@ -33,7 +33,7 @@ internal static void Evaluate(FunctionArgs functionArgs) } catch (Exception e) when (e is not NCalcExtensionsException or FormatException) { - throw new FormatException($"Could not evaluate {ExtensionFunction.Switch} function parameter 1 '{functionArgs.Parameters[0].ParsedExpression}'."); + throw new FormatException($"Could not evaluate {ExtensionFunction.Switch} function parameter 1 '{functionArgs.Parameters[0].LogicalExpression}'."); } // Determine the pair count diff --git a/PanoramicData.NCalcExtensions/GlobalUsings.cs b/PanoramicData.NCalcExtensions/GlobalUsings.cs index 4c207e8..24df3f2 100644 --- a/PanoramicData.NCalcExtensions/GlobalUsings.cs +++ b/PanoramicData.NCalcExtensions/GlobalUsings.cs @@ -1,4 +1,6 @@ global using NCalc; +global using NCalc.Domain; +global using NCalc.Handlers; global using Newtonsoft.Json.Linq; global using PanoramicData.NCalcExtensions.Exceptions; global using PanoramicData.NCalcExtensions.Extensions; diff --git a/PanoramicData.NCalcExtensions/Lambda.cs b/PanoramicData.NCalcExtensions/Lambda.cs index 25e560e..1fd6c63 100644 --- a/PanoramicData.NCalcExtensions/Lambda.cs +++ b/PanoramicData.NCalcExtensions/Lambda.cs @@ -4,7 +4,7 @@ namespace PanoramicData.NCalcExtensions; public class Lambda( string predicate, string nCalcString, - Dictionary parameters) + IDictionary parameters) { public object? Evaluate(T value) { diff --git a/PanoramicData.NCalcExtensions/PanoramicData.NCalcExtensions.csproj b/PanoramicData.NCalcExtensions/PanoramicData.NCalcExtensions.csproj index f4404c1..404c83b 100644 --- a/PanoramicData.NCalcExtensions/PanoramicData.NCalcExtensions.csproj +++ b/PanoramicData.NCalcExtensions/PanoramicData.NCalcExtensions.csproj @@ -43,7 +43,7 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive