Marius
Marius

Reputation: 9674

How can I make TypedFactory ignore NoTrackingReleasePolicy

We have enabled the "NoTrackingReleasePolicy" on our windsor containers, and today I found out that the excellent TypedFactoryFacility honours our choice and does not dispose of components created through the factory when invoking a void method on the factory.

I know that if you treat your services right (resolve, act and release) we could simply remove the NoTrackingReleasePolicy and everything would work nicely. Sadly, this is not an option (I can't guarantee that someone on our team with a bit less IOC framework experience than myself is forgetting to release some transient components).

So, I would like to have my cake and eat it too, or in others words: can I alter the TypedFactoryFacility so that it ignores the kernel release policy and tracks the components created through the factory?

Upvotes: 1

Views: 339

Answers (1)

Krzysztof Kozmic
Krzysztof Kozmic

Reputation: 27374

No, you can't.

I would strongly advise you to revisit how you architect your application, and with tools like NDepend you can ensure the rules are being followed.

Check the following posts discussing the (simple) rule for when you need to release your components explicitly: http://kozmic.pl/2010/08/27/must-i-release-everything-when-using-windsor/

Upvotes: 1

Related Questions