views:

179

answers:

1

I'm using StructureMap to Enrich some of my objects with an instance call to

ProxyGenerator.CreateInterfaceProxyWithTarget(myObject, MYInterceptor)

Currently I have the MYInterceptor inside my container, should I implement any type of caching for the interceptor?

The second question should I register my ProxyGenerator inside my container and if so, should I apply any type of caching to it?

+1  A: 

you most likely want to reuse the same ProxyGenerator to take advantage of its proxy type caching capabilities.

About the interceptor - it depends. Is it purely functional? Does it have its own state? There's no general rule for that, so you need to decide whether you need a new instance for each new proxy, or can the same instance be reused (which makes sense almost exclusively when interceptor has no state on its own)

Krzysztof Koźmic
My interceptor is entirely stateless which is why i wasn't sure if it mattered to be cached, it's so hard to imagine software development without using IOC today there's nothing like saying .Singleton or .HttpSession and your objects get magically cached.
Chris Marisic