Ejemplo n.º 1
0
        public D3NEGraph UpdateUserDefinedFunction(string name, D3NEGraph graph, string updatedBy)
        {
            var constructor = new ExpressionTreeConstructor(name, graph, FunctionsFacade);
            // Graph Validation
            var tree = constructor.Construct();

            return(UserDefinedFuncsRepo.UpdateFunction(name, graph, updatedBy));
        }
Ejemplo n.º 2
0
        public object ExecuteUserDefinedFunction(string name, FunctionExecutionRequest request)
        {
            var function = UserDefinedFuncsRepo.GetFunctionGraph(name);

            if (function == null)
            {
                return(null);
            }

            object[] objArgs = new object[request.Arguments.Length];
            for (int i = 0; i < request.Arguments.Length; i++)
            {
                objArgs[i] = DataTypes.Parse(request.Arguments[i].Value, request.Arguments[i].Type);
            }
            var constructor = new ExpressionTreeConstructor(name, function, FunctionsFacade);
            var expTree     = constructor.Construct();
            var lambda      = expTree.Compile();
            var result      = lambda.DynamicInvoke(objArgs);

            return(result);
        }