Update : DeleteableByObject UpdateableByObject InsertableByObject

This commit is contained in:
sunkaixuan
2023-03-30 19:16:28 +08:00
parent 6bd6b2a67a
commit 119989ae69
4 changed files with 9 additions and 3 deletions

View File

@@ -24,7 +24,7 @@ namespace SqlSugar
{
if (Context == null) return 0;
var inertable = MethodInfo.Invoke(Context, new object[] { objectValue });
var result = inertable.GetType().GetMethod("ExecuteCommandAsync").Invoke(inertable, new object[] { });
var result = inertable.GetType().GetMyMethod("ExecuteCommandAsync",0).Invoke(inertable, new object[] { });
return await(Task<int>)result;
}
}

View File

@@ -24,7 +24,7 @@ namespace SqlSugar
{
if (Context == null) return 0;
var inertable = MethodInfo.Invoke(Context, new object[] { objectValue });
var result = inertable.GetType().GetMethod("ExecuteCommandAsync").Invoke(inertable, new object[] { });
var result = inertable.GetType().GetMyMethod("ExecuteCommandAsync",0).Invoke(inertable, new object[] { });
return await (Task<int>)result;
}
public int ExecuteReturnIdentity()

View File

@@ -25,7 +25,7 @@ namespace SqlSugar
{
if (Context == null) return 0;
var inertable = MethodInfo.Invoke(Context, new object[] { objectValue });
var result = inertable.GetType().GetMethod("ExecuteCommandAsync").Invoke(inertable, new object[] { });
var result = inertable.GetType().GetMyMethod("ExecuteCommandAsync",0).Invoke(inertable, new object[] { });
return await (Task<int>)result;
}
}

View File

@@ -2,6 +2,8 @@
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;
@@ -9,6 +11,10 @@ namespace SqlSugar
{
public static class CommonExtensions
{
public static MethodInfo GetMyMethod(this Type type,string name, int argCount)
{
return type.GetMethods().FirstOrDefault(it => it.Name == name && it.GetParameters().Length == argCount);
}
public static List<T> ToList<T>(this T thisValue,Func<T,T> action) where T:class,new()
{
return new List<T> { thisValue };