Example #1
0
        private void ResolveUpdateMethodCall(MethodCallExpression callExpression)
        {
            var arguments = callExpression.Arguments.Select(GetExpressionValue).ToArray();
            var resolver  = StatementResolvers.FirstOrDefault(_ => _.SupportedMethod == callExpression.Method);

            if (resolver == null)
            {
                throw new
                      NotSupportedException($"The provided method expression {callExpression.Method.DeclaringType.Name}.{callExpression.Method.Name}() is not supported");
            }

            resolver.ResolveStatement(Builder, callExpression, arguments);
        }
Example #2
0
        private void ResolveUpdateMethodCall(MemberAssignment assignment, MethodCallExpression callExpression)
        {
            var arguments = callExpression.Arguments.Select(GetExpressionValue).ToArray();
            var resolver  = StatementResolvers.FirstOrDefault(_ => _.SupportedMethod == callExpression.Method);

            if (resolver == null)
            {
                var columnName = GetColumnName(assignment);
                var node       = ResolveQuery(callExpression);
                if (node is ValueNode valueNode)
                {
                    Builder.UpdateAssignField(columnName, valueNode.Value);
                }
                else
                {
                    var expressionValue = GetExpressionValue(callExpression);
                    Builder.UpdateAssignField(columnName, expressionValue);
                }
                return;
            }
            //throw new NotSupportedException($"The provided method expression {callExpression.Method.DeclaringType.Name}.{callExpression.Method.Name}() is not supported");

            resolver.ResolveStatement(Builder, callExpression, arguments);
        }