public void BuildWithDependency(string functionFileName) { // Compile var environment = EnvironmentManager.CreateEnvironment(BASE_PATH, functionFileName); var functionFile = environment.FunctionFile; var projectFile = environment.ProjectFile; var assemblyFile = environment.AssemblyFile; var restorer = new DependencyRestorer(environment); restorer.CopyAndRestore(); var compiler = new DefaultCompiler(new DefaultParser(), new WithDependencyReferencesManager()); var function = FunctionCreator.CreateFunction(functionFile, projectFile); compiler.Compile(function); // Invoke var invoker = new DefaultInvoker(); var args = WebManager.GetHttpRequest(); object result = invoker.Execute(function, args); }
private static object ExecuteCompiledFunction(IFunction function, int timeout = 180 * 1000) { // Invoke var invoker = new TimeoutInvoker(timeout); var cancellationSource = new CancellationTokenSource(); var request = WebManager.GetHttpRequest(); (Event _event, Context _context) = new DefaultParameterHandler().GetFunctionParameters(request); return(invoker.Execute(function, cancellationSource, _event, _context)); }