mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-06-28 04:35:29 +08:00
Update db.InsertByObject
This commit is contained in:
parent
90aff49603
commit
067b200e6c
@ -12,6 +12,7 @@ namespace SqlSugar
|
||||
internal SqlSugarProvider Context { get; set; }
|
||||
internal MethodInfo MethodInfo { get; set; }
|
||||
internal object objectValue { get; set; }
|
||||
internal string[] ignoreColumns { get; set; }
|
||||
|
||||
public int ExecuteCommand()
|
||||
{
|
||||
@ -41,6 +42,18 @@ namespace SqlSugar
|
||||
var result = inertable.GetType().GetMyMethod("ExecuteReturnIdentityAsync",0).Invoke(inertable, new object[] { });
|
||||
return await (Task<int>)result;
|
||||
}
|
||||
|
||||
public CommonMethodInfo IgnoreColumns(params string [] ignoreColumns)
|
||||
{
|
||||
var inertable = MethodInfo.Invoke(Context, new object[] { objectValue });
|
||||
var newMethod = inertable.GetType().GetMyMethod("IgnoreColumns", 1, typeof(string[]));
|
||||
var result = newMethod.Invoke(inertable, new object[] { ignoreColumns });
|
||||
return new CommonMethodInfo()
|
||||
{
|
||||
Context = result
|
||||
};
|
||||
}
|
||||
|
||||
public CommonMethodInfo SplitTable()
|
||||
{
|
||||
var inertable = MethodInfo.Invoke(Context, new object[] { objectValue });
|
||||
|
@ -25,6 +25,13 @@ namespace SqlSugar
|
||||
{
|
||||
return type.GetMethods().FirstOrDefault(it => it.Name == name && it.GetParameters().Length == argCount);
|
||||
}
|
||||
public static MethodInfo GetMyMethod(this Type type, string name, int argCount,Type parameterType)
|
||||
{
|
||||
return type.GetMethods().FirstOrDefault(it =>
|
||||
it.Name == name &&
|
||||
it.GetParameters().Length == argCount&&
|
||||
it.GetParameters().First().ParameterType==parameterType);
|
||||
}
|
||||
public static List<T> ToList<T>(this T thisValue,Func<T,T> action) where T:class,new()
|
||||
{
|
||||
return new List<T> { thisValue };
|
||||
|
Loading…
Reference in New Issue
Block a user