New Posts New Posts RSS Feed: Batch delete in Silverlight (and DF)
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Batch delete in Silverlight (and DF)

 Post Reply Post Reply
Author
MaksimK View Drop Down
Newbie
Newbie


Joined: 25-Feb-2013
Posts: 6
Post Options Post Options   Quote MaksimK Quote  Post ReplyReply Direct Link To This Post Topic: Batch delete in Silverlight (and DF)
    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 ..) ? 
Back to Top
sbelini View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 13-Aug-2010
Location: Oakland
Posts: 786
Post Options Post Options   Quote sbelini Quote  Post ReplyReply Direct Link To This Post 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 and http://drc.ideablade.com/xwiki/bin/view/Documentation/code-sample-stored-procedure-queries-silverlight.
Back to Top
MaksimK View Drop Down
Newbie
Newbie


Joined: 25-Feb-2013
Posts: 6
Post Options Post Options   Quote MaksimK Quote  Post ReplyReply Direct Link To This Post Posted: 08-May-2013 at 6:32am

How to call stored proc from remote server method call ?

Back to Top
sbelini View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 13-Aug-2010
Location: Oakland
Posts: 786
Post Options Post Options   Quote sbelini Quote  Post ReplyReply Direct Link To This Post 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);


Back to Top
MaksimK View Drop Down
Newbie
Newbie


Joined: 25-Feb-2013
Posts: 6
Post Options Post Options   Quote MaksimK Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
sbelini View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 13-Aug-2010
Location: Oakland
Posts: 786
Post Options Post Options   Quote sbelini Quote  Post ReplyReply Direct Link To This Post 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.

Edited by sbelini - 08-May-2013 at 3:15pm
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down