CodeCompilation.CodeCompiler GetOrCreateCompiler() { if (cachedCompiler == null) { var runtime = RuntimeInfo.GetRuntime(); if (runtime.Error != null) { throw new TemplatingEngineException(runtime.Error); } cachedCompiler = createCompilerFunc?.Invoke(runtime) ?? new CscCodeCompiler(runtime); } return(cachedCompiler); }
internal void SetCompilerFunc(Func <RuntimeInfo, CodeCompilation.CodeCompiler> createCompiler) { cachedCompiler = null; createCompilerFunc = createCompiler; }