locked
CRM2011 - Why isn't IOrganizationService Disposable? RRS feed

  • Question

  • Why isn't IOrganizationService disposable when OrganizationServiceProxy is?

    What does that mean for any code that uses the interface instead of the OSP object?

    Should we be disposing our service when in plugins?

    Thursday, September 15, 2011 2:31 AM

Answers

  • No, you should not be disposing the service; it is not disposable because it is reused by the internal CRM application (there is one service instance established per IIS worker process, and every service call therein uses that service, thereby eliminating the overhead of creating a new service instance with each process call).  The IOrganizationService interface acts as a wrapper to a disposable object that CRM internally disposes when necessary; as a consequence, the disposal thereof through this wrapper is disallowed.  If it were possible, you might likely break operations in CRM.
    Dave Berry - MVP Dynamics CRM - http:\\crmentropy.blogspot.com Please follow the forum guidelines when inquiring of the dedicated CRM community for assistance.
    Thursday, September 15, 2011 5:56 PM
    Moderator