03/جمادى الثانية/1433 07:34 ص
Is there a way to intercept an insert statement from an uploadchanges synchronisation action from the client, in sql within the server db?
I know this can be done in code using the business interceptors, but would like to do this at the sql level. I have noticed that this can be done for select modifying the entity_selectchanges stored procedure, but cannot seem to do this for the insert. For example we have an entity_insert procedure, and I tried changing one of the input parameters manually in the procedure, but the old value still got populated to the database.
Ther reason for this is that in our application, various static data (e.g. ordertype) will be get updated to the server db, and thus be out of sync with the client IPad. In this instance the IPad will then submit an insert for an order with an incorrect orderid. As it stands the framework will simply reject this, whereas I want to be able to intercept this and substitute the old orederid for a correct one, hence the need to intercept the insert statement.
I also want to do this at the database/tsql level, as once we have deployed it is always much easier to get a db change than a software one granted.
Any help would be greatly appreciated
04/جمادى الثانية/1433 12:34 مالمشرفwhat version of sql server are you using? if it is 2008, its going to use the bulk insert statement by default instead of the entity_insert stored proc.
04/جمادى الثانية/1433 12:38 م
Yes are using 2008, and I have indeed noticed (running sql profiler), that entity_bulkinsert does indeed get called.
I actually 'hacked; entity_bulkinsert and indeed did work.
I take it from your comments that bulkinsert will always get called and so safe to hack this and leave entity_insert alone?
04/جمادى الثانية/1433 12:45 مالمشرف
afaik, if it's sql 2008, by the default that's what its going to use. i cant remember though if the conflict resolution would use the bulk sp or the other one. you might want to test by simulating a conflict. sync fx resolves conflicts by row and am not sure if it will use the bulk instead of an individual row update sp.
- تم وضع علامة كإجابة بواسطة xcfrt 04/جمادى الثانية/1433 04:05 م
04/جمادى الثانية/1433 04:05 مexcellent information, thanks June