views:

28

answers:

1

Hi,

Just doing some work with RIA services and I see in the MSDN documentation that neither it or any parents up its' hierarchy implement IDisposable. I'm wondering what the design decision was for this...as DomainContext is a stateful resource, wouldn't it be nice to have a Dispose() to release it when done ?

Thanks,

Scott

+1  A: 

A stateful object doesn't imply IDisposable is required.

The real question is what would you do in Dispose.

At best the only thing you could theoretically do is abort any pending web requests. However, that is probably better left to the app developer to call the right Cancel method - since Load/Submit are all explicit calls, Cancel should be as well.

The existence of IDisposable would be confusing as well - when is it required to be called, and when not, given the lack of concrete scenarios.

Hence no IDisposable on DomainContext.

NikhilK
Thank you for the answer! Took forever to get one on this question. I was imagining "gracefully" terminating/releasing WCF resources, but I can see where that would be a business logic decision.
Scott Davies