views:

328

answers:

2

I have three tables, Template, Fields and TemplateFields. TemplateFields holds the selected fields for each template. I need to update TemplateFields when the user is finished selecting the fields. The only way I can see to do this is by deleting all the TemplateFields for that Template and then add them one by one in separate requests. This is really bad because there is not transaction to fall back onto and there will also be MANY requests.

Is there a way of adding multiple 'objects' at once using WCF Data Services? I can then use an Interceptor to update the database.

+1  A: 

Hi, see

Batching Operations (WCF Data Services) http://msdn.microsoft.com/en-us/library/dd744839.aspx

and

How to: Execute Queries in a Batch (WCF Data Services) http://msdn.microsoft.com/en-us/library/dd744838.aspx

HTH,

--larsw

larsw
Thanks for the pointer to the right direction. The sites you gave was not for JavaScript which I require (did not specify, sorry), but I did however find this (http://www.asp.net/ajaxlibrary/OData-HOW-TO-Execute-a-Sequence-of-Actions-Through-an-OData-Service-Using-Ajax.ashx) which will help me.Thanks!
Pieter
A: 

See this article "Adding/Creating data to OData/Wcf Data Service batch explained":
http://franssenden.wordpress.com/2010/06/18/addingcreating-data-to-odatawcf-data-service-batch-explained/

Mohamed Meligy
Thanks for taking the time to answer this. My problem however was getting it done using JavaScrtipt...preferably jQuery (which I forgot to mention in the question :s ).
Pieter