示例#1
0
        public object Execute(Expression expression)
        {
            var executionPlan = ExecutionPlanBuilder.BuildPlan(
                Expression.Constant(this),
                Translate(expression));

            var lambda = Expression.Lambda(executionPlan);

            return(lambda.Compile().DynamicInvoke(null));
        }
示例#2
0
        public Task <TResult> ExecuteAsync <TResult>(Expression expression, CancellationToken cancellationToken = default(CancellationToken))
        {
            var executionPlan = ExecutionPlanBuilder.BuildAsyncPlan(
                Expression.Constant(this),
                Translate(expression),
                Expression.Constant(cancellationToken));

            var lambda = Expression.Lambda(executionPlan);

            return((Task <TResult>)lambda.Compile().DynamicInvoke(null));
        }
示例#3
0
        public object Execute(Expression expression)
        {
            var executionPlan = ExecutionPlanBuilder.BuildPlan(
                Expression.Constant(this),
                Translate(expression));

            var lambda = Expression.Lambda(executionPlan);

            try
            {
                return(lambda.Compile().DynamicInvoke(null));
            }
            catch (TargetInvocationException tie)
            {
                throw tie.InnerException;
            }
        }