Synchronization code

This commit is contained in:
sunkaixuan 2023-08-07 17:33:45 +08:00
parent 207e70b725
commit 90c1226a68
3 changed files with 10 additions and 2 deletions

View File

@ -105,7 +105,7 @@ namespace SqlSugar
}
public QueryMethodInfo Where(string sql, object parameters = null)
{
var method = QueryableObj.GetType().GetMyMethod("Where", 2, typeof(string), typeof(object));
var method = QueryableObj.GetType().GetMyMethodNoGen("Where", 2, typeof(string), typeof(object));
this.QueryableObj = method.Invoke(QueryableObj, new object[] { sql, parameters });
return this;
}

View File

@ -36,7 +36,7 @@ namespace SqlSugar
then true else false end as IsNullable
from (select * from pg_tables where upper(tablename) = upper('{0}') and schemaname='" + schema + @"') ptables inner join pg_class pclass
on ptables.tablename = pclass.relname inner join (SELECT *
FROM information_schema.columns
FROM information_schema.columns where table_schema='" + schema + @"'
) pcolumn on pcolumn.table_name = ptables.tablename
left join (
select pg_class.relname,pg_attribute.attname as colname from

View File

@ -39,6 +39,14 @@ namespace SqlSugar
it.GetParameters().First().ParameterType == parameterType&&
it.GetParameters()[1].ParameterType == parameterType2) ;
}
public static MethodInfo GetMyMethodNoGen(this Type type, string name, int argCount, Type parameterType, Type parameterType2)
{
return type.GetMethods().Where(it => it.Name == name&&it?.GetGenericArguments()?.Count()==0).FirstOrDefault(it =>
it.GetParameters().Length == argCount &&
it.GetParameters().First().ParameterType == parameterType &&
it.GetParameters()[1].ParameterType == parameterType2);
}
public static MethodInfo GetMyMethod(this Type type, string name, int argCount, Type parameterType, Type parameterType2, Type parameterType3)
{
return type.GetMethods().Where(it => it.Name == name).FirstOrDefault(it =>