How to cancel/change update or insert


how can I cancel/change an update (put/patch) or insert in XData?

I would like to have my special logic in updating records. I think I will have to use an event handler, check some Args-Values and depending on that values foreward the request or cancel it. I would like to do my own special update, sometimes forewarding a changed request, sometimes doing my own logic, without sending an exception back to the user. (for example: update another field in an different table before updating the original field) How is it done in the event method?


  procedure(Args: TEntityModifyingArgs)


    // code here





Hello Harald,

Yes, you should use that code above. To cancel something, you should raise an exception.
For anything else, just add the specific code you need. If you have a question about how to accomplish something specific you don't know how to do, just let me know I can guide you.
You could also consider just disabling the entity publishing and create service operations, if you have too much complex code to do, a service operation is easier to implement and less confusing, as you don't have to deal with events but just implement the whole request processing in the method directly.
Hello Wagner,

thank You for Your answer.

I have the situation that I can read from a MySQL DB directly (IDBConnection) but am not allowed to write to this DB. For writing access I only hava a soap interface. For the customers I would like to hide this details - and would like to provide a normal Rest-Interface without showing that there are technical differences between the reading and the writing.

So I would like to capture the put / patch / post events, transform them into soap commands and after writing the object via soap read this Object again and return it as a result of the put / patch / post.

For this it is necessary that the request to put / patch / post is not forewarded to the default processing - and I must provide my own result to the response.

Is there an easy way to accomplish this? Service operations would always be a solution, but for this the Rest-Interface will be broken.


I'd suggest using service operations. Using entity publish would require too much unneeded workaround. The reason for entity publishing is to provide a plug-and-play way to provide data. If you are not using that mechanism, it doesn't make much sense to tweak it to change its behavior.

Just use service operation, I don't see why Rest-Interface would be broken?

Hi Wagner,

Is it possible, with service operations, to implement something like 

 GET, PUT or DELETE /xdata/SomeService/SomeOp(id) 

Similar to published entities ?

Sorry, I meant:

For methods you can add attributes like [HttpGet]:

For the parameter between parenthesis, that is not supported, it should be in the format ?param=value.
Here is info about it: