Disabling interception for a specific type attribute

Jul 16, 2012 at 9:18 PM

Hi,

We are using unit 1.2.  We have cachingAttribute and respective call handler to handle caching specifc requests.  We apply the CachingAttribute on interface methods and the return type of the method will be cached and intercepted for the consiquitve calls.

Since we are using unity interception for non web hosts also and we may or may not use the caching, but the types where the cachingAttribute is applied may be reused in non web hosts (e.g services, batches).  So we wanted to disable cachingAttribute from non web hosts.

Is there any way to disable the interception for specifc attribute types? If yes please let me know if any sample implementation.

Thanks

Srini

Jul 18, 2012 at 6:00 AM

If you want different behavior for different hosting environments then you have the opportunity to configure Unity differently for each host.  E.g. different matching rules, different interception rules (default, or named registrations).  Another option that is available is to create a custom matching rule to perform any specific matching (or exclusions) you wish.

--
Randy Levy
Enterprise Library support engineer
entlib.support@live.com