Question

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?

Was it helpful?

Solution

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)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top