I have an mcml page that makes use of a class I have written. Everytime I go to this page using HistoryOrientedPageSession.GotoPage I create a new instance of the class and pass it in as a property. What I am concerned about is the lifetime of my class instance. Since the mcml page has a reference to it I am presuming my class instance won't be collected by the garbage collector until the mcml page is no longer referenced (I don't have any references to the instance any where else in my code). I have no control over how long HistoryOrientedPageSession will keep a reference to my mcml page, I cannot therefore influence the lifetime of my class instance. Is this correct? Also, If my class instance needs to do some tidying up before it's dereferenced is there anyway I can make sure a Dispose call is made to it?
Have I made a design mistake or am I missing something?
Thanks
Martin