mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-09-22 20:13:41 +08:00
Add db.DeleteableByObject(o).ExecuteCommandAsync()
This commit is contained in:
@@ -57,7 +57,7 @@ namespace OrmTest
|
|||||||
|
|
||||||
|
|
||||||
object o = db.Queryable<Order>().First();
|
object o = db.Queryable<Order>().First();
|
||||||
db.DeleteableByObject(o).ExecuteCommand();
|
db.DeleteableByObject(o).ExecuteCommandAsync().GetAwaiter().GetResult();
|
||||||
object os = db.Queryable<Order>().Take(2).ToList();
|
object os = db.Queryable<Order>().Take(2).ToList();
|
||||||
db.DeleteableByObject(os).ExecuteCommand();
|
db.DeleteableByObject(os).ExecuteCommand();
|
||||||
Console.WriteLine("#### Deleteable End ####");
|
Console.WriteLine("#### Deleteable End ####");
|
||||||
|
@@ -3,6 +3,7 @@ using System.Collections;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace SqlSugar
|
namespace SqlSugar
|
||||||
{
|
{
|
||||||
@@ -19,5 +20,12 @@ namespace SqlSugar
|
|||||||
var result= inertable.GetType().GetMethod("ExecuteCommand").Invoke(inertable,new object[] { });
|
var result= inertable.GetType().GetMethod("ExecuteCommand").Invoke(inertable,new object[] { });
|
||||||
return (int)result;
|
return (int)result;
|
||||||
}
|
}
|
||||||
|
public async Task<int> ExecuteCommandAsync()
|
||||||
|
{
|
||||||
|
if (Context == null) return 0;
|
||||||
|
var inertable = MethodInfo.Invoke(Context, new object[] { objectValue });
|
||||||
|
var result = inertable.GetType().GetMethod("ExecuteCommandAsync").Invoke(inertable, new object[] { });
|
||||||
|
return await(Task<int>)result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user