Example #1
0
        public ObParameterBase LikeRight(ObProperty obProperty)
        {
            Type t          = Assembly.Load(ASSEMBLY_STRING).GetType(CLASS_NAME);
            var  parameters = new object[]
            {
                this,
                DbSymbol.LikeRight,
                obProperty
            };

            return((ObParameterBase)Activator.CreateInstance(t, parameters));
        }
Example #2
0
        public static ObProperty <TSource> RowNumber <TSource>(this TSource source, Func <TSource, IObGroup> keySelector, Func <TSource, IObSort> keySelector2)
            where TSource : ObTermBase
        {
            var iObSort     = keySelector2(source);
            var iObGroup    = keySelector(source);
            var iObProperty = new ObProperty <TSource>(source, iObSort.List.First().ObProperty)
            {
                DbFunc = DbFunc.RowNumber,
                Sort   = iObSort,
                Group  = iObGroup
            };

            return(iObProperty);
        }
Example #3
0
        /// <summary>
        /// 创建分组
        /// </summary>
        /// <param name="source"></param>
        /// <param name="obProperty"></param>
        /// <returns></returns>
        private static IObGroup <TSource> ObGroup_Create <TSource>(TSource source, ObProperty obProperty)
            where TSource : ObTermBase
        {
            var type       = typeof(TSource);
            var className  = CLASS_NAME + "`1[[" + type.FullName + "," + type.Assembly.FullName + "]]";
            var t          = Assembly.Load(ASSEMBLY_STRING).GetType(className);
            var parameters = new object[]
            {
                source,
                obProperty
            };

            return((IObGroup <TSource>)Activator.CreateInstance(t, parameters));
        }
Example #4
0
        public static ObProperty Sum(ObProperty obProperty)
        {
            if (obProperty.DbFunc == DbFunc.Null)
            {
                obProperty.DbFunc           = DbFunc.Sum;
                obProperty.FuncBrotherCount = obProperty.Brothers.Count;
                return(obProperty);
            }
            var iObProperty = new ObProperty(obProperty)
            {
                DbFunc       = DbFunc.Sum,
                CustomParams = new object[] { obProperty }
            };

            return(iObProperty);
        }
Example #5
0
        public static ObProperty ToDecimal(ObProperty obProperty, int length, int precision)
        {
            /*if (obProperty.DbFunc == DbFunc.Null)
             * {
             *  obProperty.DbFunc = DbFunc.ToDecimal;
             *  obProperty.FuncBrotherCount = obProperty.Brothers.Count;
             *  return obProperty;
             * }*/
            var iObProperty = new ObProperty(obProperty)
            {
                DbFunc       = DbFunc.ToDecimal,
                CustomParams = new object[] { obProperty, length, precision }
            };

            return(iObProperty);
        }
Example #6
0
        public static ObProperty ToString(ObProperty obProperty, int type)
        {
            /*if (obProperty.DbFunc == DbFunc.Null)
             * {
             *  obProperty.DbFunc = DbFunc.ToString;
             *  obProperty.FuncBrotherCount = obProperty.Brothers.Count;
             *  return obProperty;
             * }*/
            var iObProperty = new ObProperty(obProperty)
            {
                DbFunc       = DbFunc.ToString,
                CustomParams = new object[] { obProperty, type }
            };

            return(iObProperty);
        }
Example #7
0
        public static ObProperty ToString(ObProperty obProperty, string format)
        {
            /*if (obProperty.DbFunc == DbFunc.Null)
             * {
             *  obProperty.DbFunc = DbFunc.ToDecimal;
             *  obProperty.FuncBrotherCount = obProperty.Brothers.Count;
             *  return obProperty;
             * }*/
            var iObProperty = new ObProperty(obProperty)
            {
                DbFunc       = DbFunc.Format,
                CustomParams = new object[] { obProperty, format }
            };

            return(iObProperty);
        }
Example #8
0
        public static ObProperty IndexOf(ObProperty obProperty, string value)
        {
            /*if (obProperty.DbFunc == DbFunc.Null)
             * {
             *  obProperty.DbFunc = DbFunc.Replace;
             *  obProperty.FuncBrotherCount = obProperty.Brothers.Count;
             *  return obProperty;
             * }*/
            var iObProperty = new ObProperty(obProperty)
            {
                DbFunc       = DbFunc.Replace,
                CustomParams = new object[] { obProperty, value }
            };

            return(iObProperty);
        }
Example #9
0
        public static ObProperty SubString(ObProperty obProperty, int startIndex, int length)
        {
            /*if (obProperty.DbFunc == DbFunc.Null)
             * {
             *  obProperty.DbFunc = DbFunc.SubString;
             *  obProperty.FuncBrotherCount = obProperty.Brothers.Count;
             *  return obProperty;
             * }*/
            var iObProperty = new ObProperty(obProperty)
            {
                DbFunc       = DbFunc.SubString,
                CustomParams = new object[] { obProperty, startIndex + 1, length }
            };

            return(iObProperty);
        }
Example #10
0
        public static ObProperty Custom(string func, params object[] parameters)
        {
            var property = parameters.FirstOrDefault(p => p is IObProperty);

            if (property == null)
            {
                throw new Exception("自定义函数参数中必须有一个类型为IObProperty");
            }
            var obProperty = new ObProperty((IObProperty)property)
            {
                DbFunc       = DbFunc.Custom,
                FuncName     = func,
                CustomParams = parameters
            };

            return(obProperty);
        }
Example #11
0
        public static ObProperty <TSource> ToString <TSource>(this TSource source, Func <TSource, ObProperty> keySelector, string format)
            where TSource : ObTermBase
        {
            var iObProperty = keySelector(source);

            /*if (iObProperty.DbFunc == DbFunc.Null)
             * {
             *  iObProperty.DbFunc = DbFunc.ToDecimal;
             *  iObProperty.FuncBrotherCount = iObProperty.Brothers.Count;
             *  return new ObProperty<TSource>(source, iObProperty);
             * }*/
            var obProperty = new ObProperty <TSource>(source, iObProperty)
            {
                DbFunc       = DbFunc.Format,
                CustomParams = new object[] { iObProperty, format }
            };

            return(obProperty);
        }
Example #12
0
        public static ObProperty <TSource> ToString <TSource>(this TSource source, Func <TSource, ObProperty> keySelector)
            where TSource : ObTermBase
        {
            var iObProperty = keySelector(source);

            if (iObProperty.DbFunc == DbFunc.Null)
            {
                iObProperty.DbFunc           = DbFunc.ToString;
                iObProperty.FuncBrotherCount = iObProperty.Brothers.Count;
                return(new ObProperty <TSource>(source, iObProperty));
            }
            var obProperty = new ObProperty <TSource>(source, iObProperty)
            {
                DbFunc       = DbFunc.ToString,
                CustomParams = new object[] { iObProperty }
            };

            return(obProperty);
        }
Example #13
0
        public static ObProperty <TSource> ToDecimal <TSource>(this TSource source, Func <TSource, ObProperty> keySelector, int length, int precision)
            where TSource : ObTermBase
        {
            var iObProperty = keySelector(source);

            /*if (iObProperty.DbFunc == DbFunc.Null)
             * {
             *  iObProperty.DbFunc = DbFunc.ToDecimal;
             *  iObProperty.FuncBrotherCount = iObProperty.Brothers.Count;
             *  return new ObProperty<TSource>(source, iObProperty);
             * }*/
            var obProperty = new ObProperty <TSource>(source, iObProperty)
            {
                DbFunc       = DbFunc.ToDecimal,
                CustomParams = new object[] { iObProperty, length, precision }
            };

            return(obProperty);
        }
Example #14
0
        public static ObProperty <TSource> IndexOf <TSource>(this TSource source, Func <TSource, ObProperty> keySelector, string value)
            where TSource : ObTermBase
        {
            var iObProperty = keySelector(source);

            /*if (iObProperty.DbFunc == DbFunc.Null)
             * {
             *  iObProperty.DbFunc = DbFunc.Replace;
             *  iObProperty.FuncBrotherCount = iObProperty.Brothers.Count;
             *  return new ObProperty<TSource>(source, iObProperty);
             * }*/
            var obProperty = new ObProperty <TSource>(source, iObProperty)
            {
                DbFunc       = DbFunc.IndexOf,
                CustomParams = new object[] { iObProperty, value }
            };

            return(obProperty);
        }
Example #15
0
        public static ObProperty <TSource> SubString <TSource>(this TSource source, Func <TSource, ObProperty> keySelector, int startIndex, int length)
            where TSource : ObTermBase
        {
            var iObProperty = keySelector(source);

            /*if (iObProperty.DbFunc == DbFunc.Null)
             * {
             *  iObProperty.DbFunc = DbFunc.SubString;
             *  iObProperty.FuncBrotherCount = iObProperty.Brothers.Count;
             *  return new ObProperty<TSource>(source, iObProperty);
             * }*/
            var obProperty = new ObProperty <TSource>(source, iObProperty)
            {
                DbFunc       = DbFunc.SubString,
                CustomParams = new object[] { iObProperty, startIndex + 1, length }
            };

            return(obProperty);
        }
Example #16
0
        public static ObProperty <TSource> Custom <TSource>(this TSource source, string func, Func <TSource, object[]> keySelector)
            where TSource : ObTermBase
        {
            var parameters = keySelector(source);
            var property   = parameters.FirstOrDefault(p => p is IObProperty);

            if (property == null)
            {
                throw new Exception("自定义函数参数中必须有一个类型为IObProperty");
            }
            var obProperty = new ObProperty <TSource>(source, (IObProperty)property)
            {
                DbFunc       = DbFunc.Custom,
                FuncName     = func,
                CustomParams = parameters
            };

            return(obProperty);
        }
Example #17
0
 /// <summary>
 /// 创建单个属性分组
 /// </summary>
 /// <param name="obProperty"></param>
 /// <returns></returns>
 public static IObGroup Create(ObProperty obProperty)
 {
     return(ObGroup_Create(obProperty));
 }
Example #18
0
        /// <summary>
        /// 创建条件
        /// </summary>
        /// <param name="obProperty">属性</param>
        /// <param name="dbSymbol">条件符号</param>
        /// <param name="obProperty2">属性2</param>
        /// <returns></returns>
        public static ObParameterBase Create(ObProperty obProperty, DbSymbol dbSymbol, ObProperty obProperty2)
        {
            Type t          = Assembly.Load(ASSEMBLY_STRING).GetType(CLASS_NAME);
            var  parameters = new object[]
            {
                obProperty,
                dbSymbol,
                obProperty2
            };

            return((ObParameterBase)Activator.CreateInstance(t, parameters));
        }
Example #19
0
/*        public static IObSort Create(ObProperty obProperty)
 *      {
 *          return ObSort_Create(obProperty, true);
 *      }*/

        /// <summary>
        /// 创建单个属性排序
        /// </summary>
        /// <param name="obProperty"></param>
        /// <param name="sort"></param>
        /// <returns></returns>
        public static IObSort Create(ObProperty obProperty, Sort sort = Sort.Ascending)
        {
            return(ObSort_Create(obProperty, sort == Sort.Ascending));
        }