/// <summary> /// Compiles the <paramref name="formula" />. /// </summary> /// <param name="formula">The formula that should be compiled.</param> public static Func <bool> Compile(TExecutableModel exectutableModel, Formula formula) { Requires.NotNull(formula, nameof(formula)); var visitor = new FormulaCompilationVisitor <TExecutableModel>(exectutableModel); visitor.Visit(formula); return(Expression.Lambda <Func <bool> >(visitor._expression).Compile()); }
public static Func <bool> Compile <TExecutableModel>(this TExecutableModel executableModel, Formula formula) where TExecutableModel : ExecutableModel <TExecutableModel> { return(FormulaCompilationVisitor <TExecutableModel> .Compile(executableModel, formula)); }