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