/// <summary> /// 指定条件删除 /// </summary> /// <typeparam name="TModel"></typeparam> /// <param name="expression"></param> /// <returns></returns> public override int Delete <TModel>(Expression <Func <TModel, bool> > expression) { LambdaQuery <TModel> query = new RelationLambdaQuery <TModel>(dbContext, false); query.Where(expression); string condition = query.FormatExpression(expression.Body).SqlOut; query.FillParames(this); return(Delete <TModel>(condition)); }
internal override TType GetFunction <TType, TModel>(Expression <Func <TModel, bool> > expression, Expression <Func <TModel, TType> > selectField, FunctionType functionType, bool compileSp = false) { LambdaQuery <TModel> query = new RelationLambdaQuery <TModel>(dbContext, true); query.Select(selectField.Body); query.__FieldFunctionFormat = string.Format("{0}({1}) as Total", functionType, "{0}"); query.Where(expression); var result = QueryScalar(query); if (result == null || result is DBNull) { return(default(TType)); } return((TType)result); }