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)); }
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); }
/// <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)); }
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); }
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); }
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); }
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); }
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); }
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); }
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); }
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); }
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); }
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); }
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); }
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); }
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); }
/// <summary> /// 创建单个属性分组 /// </summary> /// <param name="obProperty"></param> /// <returns></returns> public static IObGroup Create(ObProperty obProperty) { return(ObGroup_Create(obProperty)); }
/// <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)); }
/* 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)); }