Note: Forums will be making significant UX changes to address key usability improvements surrounding search, discoverability and navigation. To learn more about these changes please visit the announcement which can be found HERE.

已答复 When to call Dispose on Project Server

All Replies

  • Monday, April 30, 2012 11:10 AM
     
     Answered Has Code

    Hi there--

    I am sure that you know PS2010 is installed with SPS2010 so the rules on SPS 2010 is good with PS2010.  As a good practice we regularly review ULS logs for SharePoint which keeps logs for Dispose() related leaks that have occurred during runtime.

    SharePoint Server internally is instrumented to report on Dispose related leaks.

    In Project Server programming, I generally follow the basics of disposing objects in Finally for example :If I have used a Resource Web service, Resource dataset, permission dataset etc, at the finally block, will dispose the objects.

    finally
    {
        // Dispose of PSI objects.
        if (_resourcePsi != null) _resourcePsi.Dispose();
        if (_resData != null) _resData.Dispose();
        if (_authData != null) _authData.Dispose();
    } // End finally

    While we call the SharePoint context on site/web/currnet site, We can use the similar one which is describled in link.
    As an alternate, I also use the FxCop analysis, if something missed out during the code.

    Hope I was able to give my 2 cents.

    Thanks,


    Thanks, Amit Khare |EPM Consultant| Blog: http://amitkhare82.blogspot.com http://www.linkedin.com/in/amitkhare82