private Expression VisitExecuteMethodCall(MethodCallExpression node) { switch (node.Method.Name) { case MethodCall.From: var value = (Func <ITableRegions, string>)node.Arguments[1].GetValueFromExpression(); if (value == null) { throw new DException("指定表名称不能为空!"); } SetTableFactory(value); base.Visit(node.Arguments[0]); return(node); case MethodCall.Where: if (Behavior == ExecuteBehavior.Insert) { throw new ExpressionNotSupportedException("插入语句不支持条件,请在查询器中使用条件过滤!"); } return(MakeWhereNode(node)); case MethodCall.Update: Behavior = ExecuteBehavior.Update; base.Visit(node.Arguments[0]); SQLWriter.AppendAt = 0; SQLWriter.Update(); SQLWriter.Alias(GetOrAddTablePrefix(typeof(T))); SQLWriter.Set(); base.Visit(node.Arguments[1]); SQLWriter.From(); WriteTable(typeof(T)); SQLWriter.AppendAt = -1; return(node); case MethodCall.Delete: Behavior = ExecuteBehavior.Delete; base.Visit(node.Arguments[0]); SQLWriter.AppendAt = 0; SQLWriter.Delete(); SQLWriter.Alias(GetOrAddTablePrefix(typeof(T))); SQLWriter.From(); WriteTable(typeof(T)); SQLWriter.AppendAt = -1; return(node); case MethodCall.Insert: Behavior = ExecuteBehavior.Insert; base.Visit(node.Arguments[0]); SQLWriter.AppendAt = 0; SQLWriter.Insert(); WriteTable(typeof(T)); SQLWriter.AppendAt = -1; VisitBuilder(node.Arguments[1]); return(node); } throw new ExpressionNotSupportedException(); }