Fix " worklist item xxx,xxx,xx,not found for xx" Problem

if invoke the function that named DoK2Process() in the same page two times ,the error happen.

  private void DoK2Process(string ProcSN)
    {
        using (TransactionScope trancat = new TransactionScope())
        {
            SourceCode.K2ROM.WorklistItem worklistitem = K2RomWP.GetWorklistItem(ProcSN);
            //To do:worklistitem do something

            //finally
            worklistitem.Finish();
        }
    }

But if you debug to trace this funciton ,it can run successfully.
So First I guess that error occur by TransactionScope delay in disposing.

So I add codes to dispose it and then run it again, i failed again.

And I look through WorklistItem class,found it provide
Finish(bool Sync) function . So I Invoke this function (Finish(True)) in DoK2Process function and run it again.

Bingo,I am right.

there was also  info about this problem i found.

"As I understand, calling the worklistitem.Finish(true) means that the call is made synchronously - meaning the worklist item has been completed by the time the call returns. Otherwise, calling just worklistitem.Finish() means that the call returns before the worklist item is actually finished because the worklistitem is actually finished in a separate thread"

 

And You also Can  see the whole info  Here :http://k2underground.com/forums/thread/18564.aspx

Posted on 2008-05-16 14:33 Enzo 阅读(142) 评论(0)  编辑 收藏

标题  
姓名  
主页
Email (博主才能看到) 
验证码 *  看不清,换一张 [登录][注册]
内容(请不要发表任何与政治相关的内容)  
  登录  使用高级评论  新用户注册  返回页首  恢复上次提交      


相关链接: