When to call Dispose on Project Server
-
2012年4月27日 下午 05:58
Hi, familiar with the guidance on Dispose in SharePoint... found this article:
Made me wonder... are there any occasions when coding for Project Server 2010 where Dispose should NOT be called?
所有回覆
-
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 finallyWhile 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