views:

20

answers:

0

I want to use Enterprise Library 5 and Unity to intercept calls made on some WCF Data Services. If I wanted to do this on a custom object I would have an IMyObject interface and a MyObject implementation. I would then include some config in my web.config along the lines of the following (I want to add performance counters in this instance):

<container>
  <extension type="Interception" />

  <register type="IMyObject" mapTo="myObject">
    <interceptor type="TransparentProxyInterceptor"/>
    <policyInjection />
  </register>

  <interception>
    <policy name="MyPolicy">
      <matchingRule name="TestRule" type="NamespaceMatchingRule">
        <constructor>
          <param name="namespaceName" value="SomeNamespace" />
        </constructor>
      </matchingRule>
      <callHandler name="callHandler" type="PerformanceCounterCallHandler">
        <constructor>
          <param name="category" value="TestCategory"/>
          <param name="counterInstanceName" value="TestInstance"/>
        </constructor>
      </callHandler>
    </policy>
  </interception>
</container>

Now, once you have the syntax this is all relatively straightforward. However, let's now say I want to intercept the actual calls to a WCF Data Service such as so:

public class MyDataService : DataService<MyContext>

How would I set this up? It feels like I need to update the configuration to use an IDataService which the proxy would be created on, but there isn't an IDataService interface.

Any ideas?

Thanks in advance