Print Page | Close Window

Batch delete in Silverlight (and DF)

Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce 2010
Forum Discription: For .NET 4.0
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=4142
Printed Date: 20-Sep-2025 at 12:30am


Topic: Batch delete in Silverlight (and DF)
Posted By: MaksimK
Subject: Batch delete in Silverlight (and DF)
Date Posted: 07-May-2013 at 8:55am
Hello!
I need delete a bulk of entities and want NOT to load them beforehand to client. Is there any possibility to execute in Silverlight arbitrary stored proc/SQL (DELETE FROM ..) ? 



Replies:
Posted By: sbelini
Date Posted: 07-May-2013 at 10:34am
MaksimK,

EF doesn't have support for bulk updates/deletes. So, your option would be calling a stored procedure that would delete all the rows in your table. See http://drc.ideablade.com/xwiki/bin/view/Documentation/stored-procedure-queries - http://drc.ideablade.com/xwiki/bin/view/Documentation/stored-procedure-queries and http://drc.ideablade.com/xwiki/bin/view/Documentation/code-sample-stored-procedure-queries-silverlight - http://drc.ideablade.com/xwiki/bin/view/Documentation/code-sample-stored-procedure-queries-silverlight .


Posted By: MaksimK
Date Posted: 08-May-2013 at 6:32am

How to call stored proc from remote server method call ?



Posted By: sbelini
Date Posted: 08-May-2013 at 9:27am
MaksimK,

Can you explain why are you trying to call a stored proc from a RSM?

In theory you could call it just as in the client by creating an EM instance:
var em = new MyEntityManager(EntityManager);




Posted By: MaksimK
Date Posted: 08-May-2013 at 10:29am
>>Can you explain why are you trying to call a stored proc from a RSM?

I want delete a bulk of records in this proc.

>>In theory you could call it just as in the client by creating an EM instance: var em = new MyEntityManager(EntityManager);

I didn't understand how to use EM instance for this purpose. Also, I didn't understand how to use

method described in the "Stored Procedure queries" topic for deleting of records


Posted By: sbelini
Date Posted: 08-May-2013 at 10:37am
You said:

"I want delete a bulk of records in this proc."
So why not call the stored proc directly from client rather than invoke a server method and then call the stored proc?



"I didn't understand how to use EM instance for this purpose. Also, I didn't understand how to use method described in the "Stored Procedure queries" topic for deleting of records"

In the second link I provided, there is a walkthrough explaining how to use a stored proc. The principle is the same and the two differences are that your stored procedure won't return anything and that you'd execute it synchronously (if you were to run it on the server). Have you gone thru the steps? If so, what issues have you come across? Post the exceptions, if any.



Print Page | Close Window