After digging further into the use of AOP with Reactive Extensions my first post about can be improved by using the Do method instead of the Subscribe method on the IObservable<T> inside the AOP aspect OnExit method.
Why?
The previous implementation I gave would worked well for a hot observable, but for a cold observable this wouldn't apply as it would instantiate a new stream for each subscription setup in the aspect - Lee campbell has a good definition for hot & cold observables.
This means the OnExit method changes from:
to:
There isn't much difference in the implementation, the significant part is re-assigning the ReturnValue for the method execution arguments.
Why?
The previous implementation I gave would worked well for a hot observable, but for a cold observable this wouldn't apply as it would instantiate a new stream for each subscription setup in the aspect - Lee campbell has a good definition for hot & cold observables.
This means the OnExit method changes from:
to:
Comments
Post a Comment