mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-10-15 18:55:07 +08:00
Compatible with .NET CORE
This commit is contained in:
@@ -70,10 +70,14 @@ namespace SqlSugar
|
||||
return type.GetTypeInfo().IsValueType;
|
||||
}
|
||||
|
||||
|
||||
public static bool IsEntity(this Type type)
|
||||
{
|
||||
return type.GetTypeInfo().IsClass();
|
||||
}
|
||||
|
||||
public static Type ReflectedType(this MethodInfo method)
|
||||
{
|
||||
return method.ReflectedType;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -265,7 +265,7 @@ namespace SqlSugar
|
||||
|
||||
private void CheckMethod(MethodCallExpression expression)
|
||||
{
|
||||
Check.Exception(expression.Method.ReflectedType.FullName != ExpressionConst.SqlFuncFullName,string.Format(ExpressionErrorMessage.MethodError, expression.Method.Name));
|
||||
Check.Exception(expression.Method.ReflectedType().FullName != ExpressionConst.SqlFuncFullName,string.Format(ExpressionErrorMessage.MethodError, expression.Method.Name));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -14,17 +14,15 @@ namespace SqlSugar
|
||||
var express = base.Expression as MethodCallExpression;
|
||||
var isLeft = parameter.IsLeft;
|
||||
string methodName = express.Method.Name;
|
||||
if (methodName == "get_Item")
|
||||
{
|
||||
string paramterName = this.Context.SqlParameterKeyWord + ExpressionConst.Const + this.Context.ParameterIndex;
|
||||
if (methodName == "get_Item") {
|
||||
string paramterName =this.Context.SqlParameterKeyWord+ExpressionConst.Const + this.Context.ParameterIndex;
|
||||
this.Context.Parameters.Add(new SugarParameter(paramterName, ExpressionTool.DynamicInvoke(express)));
|
||||
this.Context.Result.Append(string.Format(" {0} ", paramterName));
|
||||
this.Context.Result.Append(string.Format(" {0} ",paramterName));
|
||||
this.Context.ParameterIndex++;
|
||||
return;
|
||||
}
|
||||
var isValidNativeMethod = MethodMapping.ContainsKey(methodName) && express.Method.DeclaringType.Namespace == ("System");
|
||||
if (!isValidNativeMethod&&express.Method.DeclaringType.Namespace.IsIn("System.Linq", "System.Collections.Generic") && methodName == "Contains")
|
||||
{
|
||||
var isValidNativeMethod = MethodMapping.ContainsKey(methodName)&&express.Method.DeclaringType.Namespace==("System");
|
||||
if (!isValidNativeMethod&&express.Method.DeclaringType.Namespace.IsIn("System.Linq", "System.Collections.Generic")&&methodName=="Contains") {
|
||||
methodName = "ContainsArray";
|
||||
isValidNativeMethod = true;
|
||||
}
|
||||
@@ -267,7 +265,7 @@ namespace SqlSugar
|
||||
|
||||
private void CheckMethod(MethodCallExpression expression)
|
||||
{
|
||||
Check.Exception(expression.Method.DeclaringType.FullName != ExpressionConst.SqlFuncFullName, string.Format(ExpressionErrorMessage.MethodError, expression.Method.Name));
|
||||
Check.Exception(expression.Method.ReflectedType().FullName != ExpressionConst.SqlFuncFullName,string.Format(ExpressionErrorMessage.MethodError, expression.Method.Name));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -63,11 +63,14 @@ namespace SqlSugar
|
||||
return type.GetTypeInfo().IsValueType;
|
||||
}
|
||||
|
||||
|
||||
public static bool IsEntity(this Type type)
|
||||
{
|
||||
return type.GetTypeInfo().IsClass;
|
||||
}
|
||||
|
||||
public static Type ReflectedType(this MethodInfo method)
|
||||
{
|
||||
return method.DeclaringType;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user