Search code examples
silverlightentity-frameworkwcf-ria-servicessilverlight-5.0entity-framework-5

how to get the data from delete trigger?


Suppose I have a table tab(ID, Name, ...) In delete trigger, I can get the delete data from temp table deleted like

declare @Name varchar(50)
select @Name = Name from deleted

Suppose I have a line in table like

(1, 'MyName), ...)

then in SL app, I issue a delete from WCF ria service with SubmitChange by detach the entity from entityset. But before doing so, I change Name to "Yourname". So code like

myinstance.Name="YourName";
Context.tabs.Detach(myinstance);

So I want to get the value "YourName" in trigger. How to resolve this problem.


Solution

  • The change you made in the application doesn't matter. Delete works with information stored in the database not in the application. If you want to get the new value in the trigger you must first update the record and after that execute deletion.