How can I execute a stored procedure using linq in a background/alternate thread
In my app I am using the open xml sdk to generate a word document and write the file to the response.output stream for the user to download.
At the time that the letter is generated I also need to call a SP via linq data context to update a row in my db.
I think that I need to execute this SP in a seperate thread so 开发者_如何学JAVAthat I can simultaneouly write the file to the output. my method looks like this...
protected void btnPrint_Click(object sender, EventArge e)
{
//call sp to update
//create letter and send to client
}
Is this feasible or should I avoid seperate threads?
You can try PageAsyncTask
, Page.RegisterAsyncTask
, Page.ExecuteRegisteredAsyncTasks()
etc functions and classes to do async processing. For more information read this article on eggheadcafe.
But I don't think updating a row will take longer than creating a word doc.
精彩评论