1

Closed

Provide API to retrieve wrapped services

description

The tracing layer wraps a trace-aware object around major services and formatters. Apps that need to downcast a service or formatter need a way to ask for the inner object instance.

I recommend we design for a general purpose wrapping API, not just tracing. Consider something like IWrappable<T> and Wrappable.Unwrap<T>(object). Make trace wrappers implement this and make MediaTypeFormatterCollection aware to use it.

Also fix OData code to use this when asking for the model from the ODataMediaTypeFormatter.
Closed Jun 6 at 8:13 PM by kichalla
Verified.

comments

BradWilson wrote Sep 2, 2012 at 5:00 PM

I wonder if the interface should have a property, and then use an extension method to do the actual unwrapping, in order to support multi-level wrapping (that is, you iterate to unwrap so long as what you get back continues to implement IWrappable<T>).

vijay_rk wrote Apr 11 at 5:24 PM

Introduced a new interface IDecorator with an 'Inner' property. Also added a Decorator class to do the actual unwrapping which supports multi-level unwrapping.

https://aspnetwebstack.codeplex.com/SourceControl/changeset/2bc5d0fade1a29c8a685abbe0e8abb07770c9447