protected TResult _Sum <TResult>(Expression expression) { var isSingle = QueryBuilder.IsSingle(); var lamResult = QueryBuilder.GetExpressionValue(expression, isSingle ? ResolveExpressType.FieldSingle : ResolveExpressType.FieldMultiple); return(Sum <TResult>(lamResult.GetResultString())); }
protected void _Where(Expression expression) { var isSingle = QueryBuilder.IsSingle(); var result = QueryBuilder.GetExpressionValue(expression, isSingle ? ResolveExpressType.WhereSingle : ResolveExpressType.WhereMultiple); QueryBuilder.WhereInfos.Add(SqlBuilder.AppendWhereOrAnd(QueryBuilder.WhereInfos.IsNullOrEmpty(), result.GetResultString())); }
protected Interface.IQueryable <T> _Having(Expression expression) { var isSingle = QueryBuilder.IsSingle(); var lamResult = QueryBuilder.GetExpressionValue(expression, isSingle ? ResolveExpressType.WhereSingle : ResolveExpressType.WhereMultiple); Having(lamResult.GetResultString()); return(this); }
protected Interface.IQueryable <T> _OrderBy(Expression expression, OrderByType type = OrderByType.Asc) { var isSingle = QueryBuilder.IsSingle(); var lamResult = QueryBuilder.GetExpressionValue(expression, isSingle ? ResolveExpressType.FieldSingle : ResolveExpressType.FieldMultiple); OrderBy(lamResult.GetResultString() + UtilConstants.Space + type.ToString().ToUpper()); return(this); }
public virtual Interface.IQueryable <T> In <FieldType>(Expression <Func <T, object> > expression, params FieldType[] inValues) { var isSingle = QueryBuilder.IsSingle(); var lamResult = QueryBuilder.GetExpressionValue(expression, isSingle ? ResolveExpressType.FieldSingle : ResolveExpressType.FieldMultiple); var fieldName = lamResult.GetResultString(); return(In(fieldName, inValues)); }
protected void _InQueryable(Expression <Func <T, object> > expression, KeyValuePair <string, List <Parameter> > sqlObj) { string sql = sqlObj.Key; if (sqlObj.Value.IsValuable()) { this.SqlBuilder.RepairReplicationParameters(ref sql, sqlObj.Value.ToArray(), 100); this.QueryBuilder.Parameters.AddRange(sqlObj.Value); } var isSingle = QueryBuilder.IsSingle(); var lamResult = QueryBuilder.GetExpressionValue(expression, isSingle ? ResolveExpressType.FieldSingle : ResolveExpressType.FieldMultiple); var fieldName = lamResult.GetResultString(); var whereSql = string.Format(this.QueryBuilder.InTemplate, fieldName, sql); this.QueryBuilder.WhereInfos.Add(SqlBuilder.AppendWhereOrAnd(this.QueryBuilder.WhereInfos.IsNullOrEmpty(), whereSql)); base._InQueryableIndex += 100; }
public Interface.IQueryable <T> _PartitionBy(Expression expression) { LambdaExpression lambda = expression as LambdaExpression; expression = lambda.Body; var isSingle = QueryBuilder.IsSingle(); ExpressionResult lamResult = null; string result = null; if (expression is NewExpression) { lamResult = QueryBuilder.GetExpressionValue(expression, isSingle ? ResolveExpressType.ArraySingle : ResolveExpressType.ArrayMultiple); result = string.Join(",", lamResult.GetResultArray()); } else { lamResult = QueryBuilder.GetExpressionValue(expression, isSingle ? ResolveExpressType.FieldSingle : ResolveExpressType.FieldMultiple); result = lamResult.GetResultString(); } PartitionBy(result); return(this); }