Browse Source

Update InsertByObject UpdateByObject DeleteByObject

pull/32/head
sunkaixuan 2 years ago
parent
commit
5a0f9d0674
  1. 11
      Src/Asp.NetCore2/SqlSugar/Abstract/DeleteProvider/DeleteMethodInfo.cs
  2. 27
      Src/Asp.NetCore2/SqlSugar/Abstract/DynamicBuilder/CommonMethodInfo.cs
  3. 10
      Src/Asp.NetCore2/SqlSugar/Abstract/InsertableProvider/InsertMethodInfo.cs
  4. 11
      Src/Asp.NetCore2/SqlSugar/Abstract/UpdateProvider/UpdateMethodInfo.cs

11
Src/Asp.NetCore2/SqlSugar/Abstract/DeleteProvider/DeleteMethodInfo.cs

@ -27,5 +27,16 @@ namespace SqlSugar
var result = inertable.GetType().GetMyMethod("ExecuteCommandAsync",0).Invoke(inertable, new object[] { }); var result = inertable.GetType().GetMyMethod("ExecuteCommandAsync",0).Invoke(inertable, new object[] { });
return await(Task<int>)result; return await(Task<int>)result;
} }
public CommonMethodInfo 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()
{
Context = result
};
}
} }
} }

27
Src/Asp.NetCore2/SqlSugar/Abstract/DynamicBuilder/CommonMethodInfo.cs

@ -0,0 +1,27 @@
using System;
using System.Collections.Generic;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
namespace SqlSugar
{
public class CommonMethodInfo
{
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;
}
}
}

10
Src/Asp.NetCore2/SqlSugar/Abstract/InsertableProvider/InsertMethodInfo.cs

@ -41,5 +41,15 @@ namespace SqlSugar
var result = inertable.GetType().GetMyMethod("ExecuteReturnIdentityAsync",0).Invoke(inertable, new object[] { }); var result = inertable.GetType().GetMyMethod("ExecuteReturnIdentityAsync",0).Invoke(inertable, new object[] { });
return await (Task<int>)result; return await (Task<int>)result;
} }
public CommonMethodInfo 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()
{
Context = result
};
}
} }
} }

11
Src/Asp.NetCore2/SqlSugar/Abstract/UpdateProvider/UpdateMethodInfo.cs

@ -28,5 +28,16 @@ namespace SqlSugar
var result = inertable.GetType().GetMyMethod("ExecuteCommandAsync",0).Invoke(inertable, new object[] { }); var result = inertable.GetType().GetMyMethod("ExecuteCommandAsync",0).Invoke(inertable, new object[] { });
return await (Task<int>)result; return await (Task<int>)result;
} }
public CommonMethodInfo 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()
{
Context = result
};
}
} }
} }

Loading…
Cancel
Save