Vinay Mandy
unread,Aug 23, 2011, 1:53:47 PM8/23/11Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Castle Project Users
Hi All,
I have a case where I have to resolve all instances of a specific type
of component. I know that I can use the CollectionResolver class and
then do something like:
var myComponentList = container.Resolve<IList<MyComponent>>();
However, I was unable to find any examples of how to release these
components once I'm done with them. Is it as simple as the following:
container.Release(myComponentList);
Or do I have to manually release them all individually:
foreach (var component in myComponentList)
{
container.Release(component);
}
As a follow-up question, what would be the correct 'release' procedure
if I had used a TypeFactory to resolve the collection, would a
'release' method like the one below work:
interface IMyComponentFactory
{
IList<MyComponent> CreateAllMyComponents();
void DestroyAllMyComponents(IList<MyComponent> components);
}
Thanks in advance for your help.