Skip to content

Instantly share code, notes, and snippets.

@kkozmic
Created March 8, 2011 03:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kkozmic/859776 to your computer and use it in GitHub Desktop.
Save kkozmic/859776 to your computer and use it in GitHub Desktop.
//in a per-web-request class
IKernel kernel;
List<object> tracked;
public object GetMeDaObject()
{
var obj = kernel.Resolve<DaObject>();
if(kernel.ReleasePolicy.HasTrack(obj))
{
tracked.Add(obj);
}
return obj;
}
public void Dispose()
{
tracked.ForEach(kernel.ReleaseComponent);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment