Jan 18, 2011 at 4:14 AM
Edited Jan 18, 2011 at 5:25 AM
You wrote: "The examples given show a new Target created for each call".
fluentAOP allows you to intercept all calls with a single instruction: InterceptAll(). Example:
var foo = new Proxy<IFoo>()
.OnBefore(() => Console.WriteLine("--OnBefore--"))
.OnAfter(() => Console.WriteLine("--OnAfter--"))
I created an entry in the
QuickStart page to show how to use it.
You wrote: "Where would be the best place to 'configure' the interface for future interception without having to create a new target each time?"
You could use a factory method to hide the proxy creation:
public static TTarget Create<TTarget>(TTarget target)
return new Proxy<TTarget>()
var foo = ProxyFactory.Create<IFoo>( target );
You wrote: "The problem as I see it is that the Target isn't created until the message request is deserialized so it would not be feasible to do a 'new' with each message"
WCF provides its own extensibility points. This is more likely the kind of solution you are looking for. You can customize the dispatcher runtime behavior and intercept messages before/after they are serialized into objects. Search for WCF custom behaviors.
Hopefully this will point you in the right direction.