When to call Dispose on Project Server

已答覆 When to call Dispose on Project Server

所有回覆

  • 2012年4月30日 上午 11:10
     
     已答覆 包含代碼

    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