开发者

how to achieve the project requirement

I have a method Modify() shown below

            // Convert SortedList of objects 


            if (retval) // 
            {
               // Release the database lock
               Debug.Verbose(func, "Unloc");

The functionality which i want to achieve is if flag RuntimeUp true and m_reconnectInProgress false that means if(RuntimeUp &开发者_运维知识库& !m_reconnectInProgress) i have to do the entire procees in the Modify() method otherwise i need to return 'retval' as false .We will get retval from ClientModify(col) method also which is processed by some other side

If i put check if(RuntimeUp && !m_reconnectInProgress) on the very begginning and down side else part returning retval = false is sufficient or is there any other convenient way to do that so that we can avoid bad logic

I did above assumption based on this comment obtained"" There is no need to create the list of modified objects[col.Add(dmo);] if the RuntimeUp == false and m_reconnectInProgress ==true. You can just return false at the top of the Modify method that means You can perform these checks at the beginning of the Modify method rather than waiting until the call to ClientModify ""


If I understand correctly I'd just add the lines

if(!RuntimeUp || m_reconnectInProgress) 
    return false;

At the very top of the method, which I think is a perfectly acceptable way of avoiding running the method if the application isn't in the correct state for running it right then.

However, the comment bit of your question does not mention that it should check for reconnect in progress, so I'm not sure if you should be doing that?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜