Good evening,
creating custom work controls implementing the IWorkItemControl interface has been, at least for me, always a bit of a mystery when it comes to Visual Studio / Microsoft TestManager (mtm.exe) / the hosting environment's calls to the control's .InvalidateDatasource(..) method and unfortunately the MSDN documenation lacks any usable information.
This method is called numerous times:
- sometimes twice - (as it seems) upon the control's first instantiation
- sometimes 3 times - when a control instance is being re-used/recycled for a new/different workitem
- sometimes four times upon closing a work item
- sometimes twice again - when a user presses the "Refresh" button within that work item
- sometimes it's being called after a .FlushToDatasource() call took place (to reload the data I just flushed?)
- ..and I'm pretty sure I missed a couple cases. The keyword for all of these is:sometimes. The amount it is being called in the different scenarios seems to vary, which doesn't make it any easier
Anyway, has anyone found a (as) complete (as possible) sequence of occurrences when and why these calls take place and what's the proper way to handle them (e.g. what exactly defines a first instantiation, what a refresh, what a recycle, etc is.
I am asking because stupidly (as must dummy/sample work item control projects do) handling every call with a full re-load of data seems, for expensive load activities, somewhat cumbersome and unnecessary and it would help greatly to have one proper description of the why and when these calls occur (particularly taking into consideration possible differences between the two most likely hosts (for us) - Visual Studio and MTM. These multiple calls after another just don't make sense in all cases...
Could anyone chime in / help me here?
Best regards and thanks,
-Jörg