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

    • 답변으로 표시됨 Travis Crittenden 2012년 5월 1일 화요일 오후 12:31
    •