private EvaluateResult InternalExecute(string text, IDictionary<string, object> args, QueryOptions actualOptions, CancellationToken cancelToken)
{
// Create assembly and source file names
var assemblyName = "DotQL" + DateTime.Now.Ticks;
var sourceFileName = System.IO.Path.Combine(System.IO.Path.GetTempPath(), System.IO.Path.ChangeExtension(assemblyName, "dql"));
// Save the file if we're debugging
if (Settings.DebugOn)
System.IO.File.WriteAllText(sourceFileName, text);
// Parse
var parser = new Parser() { ErrorIfNotEOF = true };
var script = Parser.ParseFrom(parser.Script, text);
// Compile
var result =
Compiler.CreateExecutable
(
new CompilerOptions
{
DefaultUsings = actualOptions.DefaultUsings,
DebugOn = Settings.DebugOn,
AssemblyName = assemblyName,
SourceFileName = sourceFileName,
Factory = Settings.RepositoryFactory,
},
script
);
// Run
return new EvaluateResult { Result = result.Execute(args, Settings.RepositoryFactory, cancelToken), Type = result.Type };
}