protected void Button1_OnClick(object sender, EventArgs e)
{
FineTuneDB();// Long Task running in db
SendSMStoAllClients();// Using Twolio API to send sms to all client long task
lblText.Text = "Button click is completed our system threads working on your request";
}
这是可能的,在按钮上单击我可以响应客户端和独立的长任务分开进行。
如果不关心任务是否完成,可以这样调用FineTuneDB
方法。
Action fineTuneDB = FineTuneDB;
fineTuneDB.BeginInvoke(null, null);
异步方法调用
更新:
Action<int, string> fineTuneDB = FineTuneDB;
fineTuneDB.BeginInvoke((int)Session["id"],
Session["name"].ToString(), null, null);
// Your method will be like this
public void FineTuneDB(int id, string)
{
}