Browse Source

Update Db.InsertableByObject

pull/33/head
sunkaixuan 1 year ago
parent
commit
5a208ea9d9
  1. 34
      Src/Asp.Net/SqlSugar/Abstract/DynamicBuilder/CommonMethodInfo.cs
  2. 4
      Src/Asp.Net/SqlSugar/Abstract/InsertableProvider/InsertMethodInfo.cs
  3. 8
      Src/Asp.Net/SqlSugar/Abstract/UpdateProvider/UpdateMethodInfo.cs

34
Src/Asp.Net/SqlSugar/Abstract/DynamicBuilder/CommonMethodInfo.cs

@ -35,5 +35,39 @@ namespace SqlSugar
return await (Task<int>)result;
}
}
public class SplitMethodInfo
{
internal object Context { get; set; }
public int ExecuteCommand()
{
if (Context == null) return 0;
var result = Context.GetType().GetMyMethod("ExecuteCommand", 0).Invoke(Context, new object[] { });
return (int)result;
}
public async Task<int> ExecuteCommandAsync()
{
if (Context == null) return 0;
var result = Context.GetType().GetMyMethod("ExecuteCommandAsync", 0).Invoke(Context, new object[] { });
return await (Task<int>)result;
}
}
public class UpdateCommonMethodInfo
{
internal object Context { get; set; }
public int ExecuteCommand()
{
if (Context == null) return 0;
var result = Context.GetType().GetMyMethod("ExecuteCommand", 0).Invoke(Context, new object[] { });
return (int)result;
}
public async Task<int> ExecuteCommandAsync()
{
if (Context == null) return 0;
var result = Context.GetType().GetMyMethod("ExecuteCommandAsync", 0).Invoke(Context, new object[] { });
return await (Task<int>)result;
}
}
}

4
Src/Asp.Net/SqlSugar/Abstract/InsertableProvider/InsertMethodInfo.cs

@ -54,12 +54,12 @@ namespace SqlSugar
};
}
public CommonMethodInfo SplitTable()
public SplitMethodInfo SplitTable()
{
var inertable = MethodInfo.Invoke(Context, new object[] { objectValue });
var newMethod = inertable.GetType().GetMyMethod("SplitTable", 0);
var result = newMethod.Invoke(inertable, new object[] { });
return new CommonMethodInfo()
return new SplitMethodInfo()
{
Context = result
};

8
Src/Asp.Net/SqlSugar/Abstract/UpdateProvider/UpdateMethodInfo.cs

@ -29,22 +29,22 @@ namespace SqlSugar
var result = inertable.GetType().GetMyMethod("ExecuteCommandAsync",0).Invoke(inertable, new object[] { });
return await (Task<int>)result;
}
public CommonMethodInfo IgnoreColumns(params string[] ignoreColumns)
public UpdateCommonMethodInfo 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()
return new UpdateCommonMethodInfo()
{
Context = result
};
}
public CommonMethodInfo SplitTable()
public UpdateCommonMethodInfo SplitTable()
{
var inertable = MethodInfo.Invoke(Context, new object[] { objectValue });
var newMethod = inertable.GetType().GetMyMethod("SplitTable", 0);
var result = newMethod.Invoke(inertable, new object[] { });
return new CommonMethodInfo()
return new UpdateCommonMethodInfo()
{
Context = result
};

Loading…
Cancel
Save