Pages

June 26, 2012

Quick guide to dispose objects in SharePoint




Ever wanted a quick reference on what to or not to dispose in SharePoint?
This is the my idea about such a guide.

How to dispose?
You can use the Dispose() method, or the Using keyword context

  
What to dispose?
to ease reading, in general: Dispose red, keep green!.

Dispose when you have: new, openWeballWebs,Webs

Do NOT dispose when you have: SPContext, RootWeb, ParentWeb

Also from latest version of SPDisposeCheck tool, this is a reference list of Do Not Dispose Rules checked:
SPListEventProperties.Web
SPWebEventProperties.Web
SPItemEventProperties.Web
SPItemEventProperties.ListItem.Web
SPItemEventProperties.Web.Site
SPItemEventProperties.ListItem.Web.Site
SPFeatureReceiverProperties.Feature.Parent
SPList.ParentWeb&SPListEventProperties.List.Web
SPWeb.ParentWeb
SPContext.Site&SPContext.Current.Site
SPContext.Web&SPContext.Current.Web
SPSite.RootWeb
SPControl.GetContextWeb(..)
SPControl.GetContextSite(..)
Microsoft.SharePoint.Administration.SPSiteAdministration.OpenWeb()
Microsoft.SharePoint.SPItemEventProperties.OpenWeb()

You can always check the latest version of SPDisposeCheck utility at: http://archive.msdn.microsoft.com/SPDisposeCheck


June 20, 2012

Ibraheem.says("Hello World!");




Hello everybody!
My name is Ibraheem and I am a passionate software developer from Iraq.
  
I started this blog because I believe in sharing of useful ideas. Technology world is becoming tougher each day with piles of layered techniques and programming stacks. We as developers are in continuous demand for useful resources to ease our tasks/jobs. As I have benefited a lot in countless times from tech blogs, I decided to start one myself and publish content that I hope to be useful to readers.
This blog will be about programming in .NET and SharePoint server. Codes on other languages and technologies will also join the content as well.
Your feedback is warmly encouraged! I really welcome and appreciate comments, recommendations, and even criticism as it is an important way to deliver high quality content and make our minds ‘work’ actively! You can comment on any post, or email me directly at: engineeribraheem@gmail.com

Ibrhaeem