Exemplo n.º 1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="lambdaWheres"></param>
        /// <returns></returns>
        public Search <T> Where(params Expression <Func <T, bool> >[] lambdaWheres)
        {
            if (lambdaWheres == null || !lambdaWheres.Any())
            {
                throw new Exception("where条件不能为空");
            }

            WhereBuilder whereBuilder = null;

            foreach (var item in lambdaWheres)
            {
                if (item == null)
                {
                    continue;
                }

                if (whereBuilder == null)
                {
                    whereBuilder = new WhereBuilder(_tableName, ExpressionToOperation <T> .ToWhereOperation(_tableName, item));
                }
                else
                {
                    whereBuilder.And(ExpressionToOperation <T> .ToWhereOperation(_tableName, item));
                }
            }

            return(Where(whereBuilder.ToWhereClip()));
        }
Exemplo n.º 2
0
 /// <summary>
 /// 删除
 /// </summary>
 /// <typeparam name="TEntity"></typeparam>
 /// <param name="tableName"></param>
 /// <param name="lambdaWhere"></param>
 /// <returns></returns>
 public int Delete <TEntity>(string tableName, Expression <Func <TEntity, bool> > lambdaWhere)
     where TEntity : Entity
 {
     return(DBContext.Delete <TEntity>(trans, tableName, ExpressionToOperation <TEntity> .ToWhereOperation(tableName, lambdaWhere)));
 }
Exemplo n.º 3
0
 /// <summary>
 /// 更新
 /// </summary>
 /// <typeparam name="TEntity"></typeparam>
 /// <param name="tableName"></param>
 /// <param name="fields"></param>
 /// <param name="values"></param>
 /// <param name="lambdaWhere"></param>
 /// <returns></returns>
 public int Update <TEntity>(string tableName, Field[] fields, object[] values, Expression <Func <TEntity, bool> > lambdaWhere)
     where TEntity : Entity
 {
     return(DBContext.Update <TEntity>(trans, tableName, fields, values, ExpressionToOperation <TEntity> .ToWhereOperation(tableName, lambdaWhere)));
 }
Exemplo n.º 4
0
 /// <summary>
 /// 更新
 /// </summary>
 /// <typeparam name="TEntity"></typeparam>
 /// <param name="tableName"></param>
 /// <param name="fieldValue"></param>
 /// <param name="lambdaWhere"></param>
 /// <returns></returns>
 public int Update <TEntity>(string tableName, Dictionary <Field, object> fieldValue, Expression <Func <TEntity, bool> > lambdaWhere)
     where TEntity : Entity
 {
     return(DBContext.Update <TEntity>(trans, tableName, fieldValue, ExpressionToOperation <TEntity> .ToWhereOperation(tableName, lambdaWhere)));
 }
Exemplo n.º 5
0
 /// <summary>
 ///
 /// </summary>
 /// <typeparam name="TEntity"></typeparam>
 /// <param name="entity"></param>
 /// <param name="lambdaWhere"></param>
 /// <returns></returns>
 public int Update <TEntity>(TEntity entity, Expression <Func <TEntity, bool> > lambdaWhere)
     where TEntity : Entity
 {
     return(DBContext.Update <TEntity>(trans, entity, ExpressionToOperation <TEntity> .ToWhereOperation(entity.GetTableName(), lambdaWhere)));
 }
Exemplo n.º 6
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="lambdaWhere"></param>
 /// <typeparam name="T2"></typeparam>
 /// <typeparam name="T3"></typeparam>
 /// <typeparam name="T4"></typeparam>
 /// <typeparam name="T5"></typeparam>
 /// <typeparam name="T6"></typeparam>
 /// <returns></returns>
 public Search <T> Select <T2, T3, T4, T5, T6>(Expression <Func <T, T2, T3, T4, T5, T6, bool> > lambdaWhere)
 {
     return(Where(ExpressionToOperation <T> .ToWhereOperation(_tableName, lambdaWhere)));
 }
Exemplo n.º 7
0
 /// <summary>
 ///
 /// </summary>
 /// <typeparam name="T2"></typeparam>
 /// <typeparam name="T3"></typeparam>
 /// <param name="lambdaWhere"></param>
 /// <returns></returns>
 public Search <T> Where <T2, T3>(Expression <Func <T, T2, T3, bool> > lambdaWhere)
 {
     return(Where(ExpressionToOperation <T> .ToWhereOperation(_tableName, lambdaWhere)));
 }
Exemplo n.º 8
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="lambdaHaving"></param>
 /// <returns></returns>
 public Search <T> Having(Expression <Func <T, bool> > lambdaHaving)
 {
     return((Search <T>)base.Having(ExpressionToOperation <T> .ToWhereOperation(_tableName, lambdaHaving)));
 }
Exemplo n.º 9
0
 /// <summary>
 ///
 /// </summary>
 /// <typeparam name="TEntity"></typeparam>
 /// <param name="field"></param>
 /// <param name="value"></param>
 /// <param name="lambdaWhere"></param>
 /// <returns></returns>
 public int Update <TEntity>(Field field, object value, Expression <Func <TEntity, bool> > lambdaWhere)
     where TEntity : Entity
 {
     return(DBContext.Update <TEntity>(trans, field, value, ExpressionToOperation <TEntity> .ToWhereOperation(lambdaWhere)));
 }
Exemplo n.º 10
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="lambdaWhere"></param>
 /// <typeparam name="T2"></typeparam>
 /// <typeparam name="T3"></typeparam>
 /// <typeparam name="T4"></typeparam>
 /// <returns></returns>
 public Search <T> Select <T2, T3, T4>(Expression <Func <T, T2, T3, T4, bool> > lambdaWhere)
 {
     return(Where(ExpressionToOperation <T> .ToWhereOperation(lambdaWhere)));
 }
Exemplo n.º 11
0
 /// <summary>
 ///
 /// </summary>
 /// <typeparam name="T2"></typeparam>
 /// <typeparam name="T3"></typeparam>
 /// <typeparam name="T4"></typeparam>
 /// <typeparam name="T5"></typeparam>
 /// <typeparam name="T6"></typeparam>
 /// <param name="lambdaWhere"></param>
 /// <returns></returns>
 public Search <T> Where <T2, T3, T4, T5, T6>(Expression <Func <T, T2, T3, T4, T5, T6, bool> > lambdaWhere)
 {
     return(Where(ExpressionToOperation <T> .ToWhereOperation(lambdaWhere)));
 }