mirror of
https://github.com/nsnail/FreeSql.git
synced 2025-06-19 20:38:16 +08:00
add test
This commit is contained in:
@ -28,13 +28,14 @@ public static partial class FreeSqlGlobalExtensions
|
||||
[typeof(uint?)] = true,
|
||||
[typeof(ulong)] = true,
|
||||
[typeof(ulong?)] = true,
|
||||
[typeof(double)] = true,
|
||||
[typeof(double?)] = true,
|
||||
[typeof(float)] = true,
|
||||
[typeof(float?)] = true,
|
||||
[typeof(decimal)] = true,
|
||||
[typeof(decimal?)] = true
|
||||
[typeof(double)] = false,
|
||||
[typeof(double?)] = false,
|
||||
[typeof(float)] = false,
|
||||
[typeof(float?)] = false,
|
||||
[typeof(decimal)] = false,
|
||||
[typeof(decimal?)] = false
|
||||
});
|
||||
public static bool IsIntegerType(this Type that) => that == null ? false : (dicIsNumberType.Value.TryGetValue(that, out var tryval) ? tryval : false);
|
||||
public static bool IsNumberType(this Type that) => that == null ? false : dicIsNumberType.Value.ContainsKey(that);
|
||||
public static bool IsNullableType(this Type that) => that?.FullName.StartsWith("System.Nullable`1[") == true;
|
||||
public static bool IsAnonymousType(this Type that) => that?.FullName.StartsWith("<>f__AnonymousType") == true;
|
||||
|
@ -387,6 +387,7 @@ namespace FreeSql.Internal
|
||||
static ConcurrentDictionary<Type, Expression> _dicFreeSqlGlobalExtensionsAsSelectExpression = new ConcurrentDictionary<Type, Expression>();
|
||||
static MethodInfo MethodDateTimeSubtractDateTime = typeof(DateTime).GetMethod("Subtract", new Type[] { typeof(DateTime) });
|
||||
static MethodInfo MethodDateTimeSubtractTimeSpan = typeof(DateTime).GetMethod("Subtract", new Type[] { typeof(TimeSpan) });
|
||||
static MethodInfo MethodMathFloor = typeof(Math).GetMethod("Floor", new Type[] { typeof(double) });
|
||||
|
||||
static string GetBoolString(string sql)
|
||||
{
|
||||
@ -489,6 +490,10 @@ namespace FreeSql.Internal
|
||||
break;
|
||||
}
|
||||
tsc.mapType = null;
|
||||
//switch(oper)
|
||||
//{
|
||||
// case "/": return ExpressionLambdaToSqlCallMath(Expression.Call(MethodMathFloor, Expression.Constant(1213.1d, typeof(double))), tsc)?.Replace("1213.1", $"{left} {oper} {right}");
|
||||
//}
|
||||
return $"{left} {oper} {right}";
|
||||
}
|
||||
public string ExpressionLambdaToSql(Expression exp, ExpTSC tsc)
|
||||
|
Reference in New Issue
Block a user