How much time is going to take a process - by WCF Service RRS feed

  • Question

  • I’m here with another question this time.

    I have an application which builds to move data from one database to another. It also deals with validation & comparison between the databases. When we start moving the data from source to destination it takes a while as it always deals with thousands of records. We use WCF service and SQL server @ server side and WPF @ client side to handle this.

    Now I have a requirement to notify user with the time it is going to take based on the source database no: records (eventually that is what im going to create in the destination database) right before user starts this movement process.

    Now my real question, which is the best way we can do this and get an estimated time out of it?

    Thanks and appreciated your helps.

    Tuesday, April 23, 2013 9:24 PM


  • Create one service operation to start the process and another one to query the progress. Make the progress query operation return the number of records processed and the number of records remaining.

    In the client, first call the start operation, and as soon as that operation has returned, keep calling the progress query operation repeatedly, as often as you need (perhaps every 5 seconds?). Have the client calculate the current speed in records per second by keeping track of how many records have been processed and how many seconds have elapsed since the last progress response, and use that to calculate the estimated amount of time remaining.

    Marcus Björklund

    To help others find useful information, please use "Propose/Mark As Answer" and/or "Vote As Helpful", as appropriate.

    Tuesday, April 23, 2013 10:39 PM