Example #1
0
 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);
 }
Example #2
0
 internal void SetCompilerFunc(Func <RuntimeInfo, CodeCompilation.CodeCompiler> createCompiler)
 {
     cachedCompiler     = null;
     createCompilerFunc = createCompiler;
 }