yes you need to sometimes ;)! context is NOT using the current context if that makes sense! I belive the workflow runs on a seperate thread to sharepoint context! The context is the workflow context to get the values where the workflow is running under.
getting the context to get the spweb and/or spsite means sharepoint will NOT handle the disposing, depending on what method you use!
You only need to dispose of it, if you create the spsite or spweb (new thread) or if its stated in msdn as somthing you have to do manually! like creating a new workflow context.
it is stated in msdn to using the disposing! , you can use the using method or call the disposable method:
protected override void Dispose(bool disposing)
// Dispose the workflow properties and workflow context when disposing
if you dont it would lead to memory leaks!
if it implements the IDisposable interface. Microsoft .NET requires objects that implement the IDisposable interface to properly cleanup the unmanaged resources by explicitly calling the Dispose() method when you are finished using them. That is if your creating like i said new ;)
having said that just to confuse you! ;) you do not need to dispose of the following:
workflowProperties.Web, workflowProperties.Site and workflowProperties.Item.
so somthing like:
SPContext context = SPContext.GetContext(workflowProperties.Web);
SPSite currentSite = context.Site;
as you can see im not using new, as im using the workflow properties context, so no need to dispose!
doing this tho:
WorkflowContext wfContext = new WorkflowContext();
you do need to dispose as your creating a new context workflow ;)
or somthing on the lines of:
SPSite site = new SPSite(workflowProperties.SiteId)
the above will need to implement the IDisposable method or use the using! Reason being, your creating a new thread (spsite) but only using the current workflow context for the site.