OrganizationServiceContext Lifetime - CRM Dynamics 2011

This is rather a non-technical issue.

We intend to use OrganizationServiceContext with Linq instead of calling OrganizationServiceProxy.

My question is: what should be the lifetime of the context? Should it create an instance once per method or can you save it for the duration of the web application using a singleton approach?

What will be the pros / cons? Any tips?

Thanks in advance

+3
source share
2 answers

You should never store a datacontext for the life of a web application. The application life cycle is managed outside of your code.

, . Datacontexts , .

, . concurrency, .

+2

Gats, , , . Silverlight, , , , , , .

+2

All Articles