I have an ASP.Net app that allows users to interact with Dynamics CRM 2011 data through early bound entities.
I am currently storing the ServiceContext and OrganizationServiceProxy in session, the reason for this is that I have to get objects of a specific type then get their related entities when a user requires it. Finally updating them when the user hits save.
I know the ServiceContext and OrganizationServiceProxy implement IDisposable and as such should be disposed. Currently I am doing this in session end in my Global.asax.
I'm in the process of testing my thinking but should I in reality instantiate and dispose of both the proxy and context whenever I get my entities or when I am done with the entire process?
All the MS guides show wrap the entire process in a using statement so that the objects are disposed but what if the process requires user interaction?