Created
March 8, 2011 03:01
-
-
Save kkozmic/859776 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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