我想在 MonoRail 基本控制器中进行异步操作。
我阅读了有关异步操作的文档 http://docs.castleproject.org/Default.aspx?Page=Controllers&NS=MonoRail&AspxAutoDetectCookieSupport=1#Asynchronous_Actions_1
所以这就是我所做的:
public IAsyncResult BeginUploadTags(HttpPostedFile xmlFile, Boolean doUpload)
{
if(IsPost)
{
IAsyncResult iAsyncResult = new AsyncDelegate(upload).BeginInvoke(queryResult, doUpload, ControllerContext.Async.Callback, ControllerContext.Async.State);
return iAsyncResult;
}
// TODO
// if IsPost is false do nothing but return a IAsyncResult object
}
public void EndUploadTags()
{
}
private delegate void AsyncDelegate(List<String> queryResult, Boolean doUpload);
private void upload(List<String> queryResult, Boolean doUpload)
{
// do upload stuff
}
但是当 IsPost 为假时我需要做什么?