Search code examples
c#wcf-data-services

WCF DataService - Cancel insert server side


We have build a simple Web Service using WCF Dataservices. This service is consumed by multiple applications.

Under some circumstances I would like to be able to inspect the inserted message on the server side, and cancel the insert if the inserted object meets specific conditions.

I found that i can inspect the insert with a QueryInterceptor, but did found no way to "Cancel" the insert.

Is it possible to cancel the insert server side, without throwing an exception?


Solution

  • you may just write a DispatchMessageInspector and inspect the message received; and you may decide whether to execute it or not without throwing any exceptions.