I've gone ahead and updated the sample for Chapter 9 - Custom Behaviors.
Rather than just do a straight port, I looked at the sample and recognized there were some opportunities to make it more interesting for the reader. I've made some changes and additions, which I think you will find beneficial -
Changed this to an EndpointBehavior. This is a more common scenario, and I think you'll find it more valuable.
Added code that shows how to add support for behaviors in the Config file. Note that this is accomplished through a combination of the code in AuditBehavior.AuditBehaviorSection.cs, by adding the behaviorExtensions section in the Service app.config, by specifying a behaviorConfiguration attribute on the endpoint element, and by defining that endpoint in the endpointBehaviors sections.
Use the behavior via configuration (service) and via code (client)
Added significant Console.Write comments so you can see exactly what is happening in which part of the code (i.e. the behavior, message inspector, etc.)
Consolidated all behavior related classes (including message inspectors) to a single project for greater clarity.
I've renamed the projects so there is no question which project is the service, which is the audit recording service, and which is the audit behavior class.
For querying the meta-data of a service, you must now explicitly do several things - add an endpoint for mex, add a behavior, and reference the behavior on the service via an attribute in the configuration file. These changes are also reflected in this sample.
09.zip (98.58 KB)
