Beispiel #1
0
 protected virtual object Append(object[] args)
 {
     if (args == null || args.Length <= 0)
     {
         return(null);
     }
     //第一个参数为LinqDLR2SqlWhereOperator,后面参数为string
     var where = args[0];
     if (where is LinqDLR2SqlWhereOperator)
     {
         using (var lwhere = (LinqDLR2SqlWhereOperator) where)
         {
             var conditions = new Dictionary <string, object>();
             foreach (var c in lwhere.ConditionValues)
             {
                 conditions.Add(c.Key, c.Value);
             }
             var appendstr = "";
             for (int i = 1; i < args.Length; i++)
             {
                 if (args[i] is string)
                 {
                     appendstr += args[i];
                 }
             }
             var newwhere = new LinqDLR2SqlWhereOperator(lwhere.Result + appendstr, conditions);
             return(newwhere);
         }
     }
     else
     {
         return(where);
     }
 }
        /// <summary>
        /// 执行linqDLR2Sql的where操作
        /// </summary>
        /// <typeparam name="TSource"></typeparam>
        /// <param name="source"></param>
        /// <param name="predicate"></param>
        /// <returns></returns>
        public static LinqDLR2Sql <TSource> Where <TSource>(this LinqDLR2Sql <TSource> source, Func <TSource, LinqDLR2SqlWhereOperator> predicate)
        {
            LinqDLR2SqlWhereOperator op = predicate.Invoke(source.Item);

            source.DoWhere(op);
            return(source);
        }
        protected override object MetaEqual(object v)
        {
            var re = "";

            if (v == null || v == DBNull.Value)
            {
                re = $"{ColumnExpress} {IsNull}";
            }
            else
            {
                re = $"{ColumnExpress}{EqualFlag}{Convert2Express(v)}";
            }

            var rtn = new LinqDLR2SqlWhereOperator(re, ConditionValues);

            return(rtn);
        }