Introduction

The EvalManager static class keep global configuration shared between evaluation instance.

Cache

Problem

You want to use your own cache to cache compiled lambda expression.

Solution

You can change the shared cache by any cache inheriting from System.Runtime.Caching.ObjectCache class.

Example

// using Z.Expressions; // Don't forget to include this.
EvalManager.Cache = MemoryCache.Default;

You can use your own cache provider inheriting from System.Runtime.Caching.ObjectCache

DefaultContext

Problem

You want to change default configuration for all evaluations context.

Solution

Change default EvalContext configuration to

Register & Unregister

Change Options

The default context is used in static methods:

Example

// using Z.Expressions; // Don't forget to include this.
EvalManager.DefaultContext.RegisterExtensionMethod(typeof(Z.ExtensionMethods))

// Make member case insensitive (Math.pOW = Math.Pow)
EvalManager.DefaultContext.BindingFlags = BindingFlags.IgnoreCase | context.BindingFlags