Validating DataServiceContext query responses RRS feed

  • Question

  • I have an SL 4 application that accesses an odata source via DataServicContext in which I'd like to perform validation (e.g. schema validation) on the odata responses.  I've searched around and haven't found a straightforward way to do this yet.

    I've hooked into the DataServiceContext.ReadingEntity event in which I do some special handling for each entity.  I suppose I could perform validation here, but this is really too late as the odata entry xml has already been parsed at this point.  Ideally I'd like to hook in before the DataServiceContext parses the xml content and instantiates the entity class to perform my validation, at which point I could validate the xml content (either the whole document, or per entry) to make sure it conforms to our schema/etc.

    I read some info on the IClientMessageInspector which seemed somewhat promising, but I was unable to relate that specifically to the WCF DataServiceContext.


    Monday, August 29, 2011 8:54 PM

All replies

  • ReadingEntity is the only place that would allow validating the response on the client.




    Tuesday, August 30, 2011 8:46 PM
  • Hi,

    I am writing to check the status of the issue on your side. Would you mind letting us know the result of the suggestions?

    If you need further assistance, please feel free to let me know. I will be more than happy to be of assistance.

    Have a nice day.

    Alan Chen[MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Friday, September 2, 2011 6:13 AM