WCF Caching Operation Invoker

This sample shows a custom WCF operation invoker which can cache some of the previous operation responses for a certain time. It works for both synchronous and asynchronous operations.

4 Star
3,520 times
Add to favorites
E-mail Twitter del.icio.us Digg Facebook
Sign in to ask a question

  • Behind the Scenes
    2 Posts | Last post March 07, 2012
    • Hi Carlos,
      I'm pretty new to WCF and I think I'm missing something obvious. I don't understand why the example is working, you created and applied an attribute but I don't understand why WCF cares. 
      the OperationInvoker is not registered in any config file, or seemingly when the host is setup in program.cs. Finally nothing happens in the attribute constructor... What am I missing? 
    • Hi Justin,
      The attribute implements the IOperationBehavior interface; when such an attribute is applied to an operation in a WCF contract, the WCF runtime will add it to the operation description, and when the service is being opened, its ApplyDispatchOperation method is called (which sets the operation invoker).
      You can find more about operation behaviors in the post at http://blogs.msdn.com/b/carlosfigueira/archive/2011/04/12/wcf-extensibility-ioperationbehavior.aspx.
  • Is is a real world sample?
    2 Posts | Last post August 17, 2011
    • I wonder if you were able to implement this invoker in a real-world project. Any results, learnings, improvments?  
    • Hi miksh, I used it in an internal testing service which we use (backend to a reporting ASPX site) not because I really needed it (not enough requests or slow running operations to make a caching really worthwhile), but because I wanted to see if it would "just work". The caching invoker didn't have any negative effect on the server, but (given the scenario) it didn't have any noticeable improvement either.