Answered by:
External OData data source that does not support $batch

Question
-
HI,
I am using an external OData data source that allows me to query everything I need to query. But I have a problem when upadtes are to be sentt back to the data source.
The problem is that LightSwitch uses the $batch put command (http://localhost:10000/defaultCollection/$batch) is there any way of telling LS to do each update seperatly?
Regards,
Mike
Tuesday, March 20, 2012 5:22 PM
Answers
-
Currently there is no supported way to make LightSwitch send separate requests for each update to the data source. The reasoning for this is because you want transaction semantics as much as possible. Say you had 2 changes: a new record and an updated record. When the client saves, it expects the whole change set to succeed or to fail. There is no notion of "the insert succeeded, but the update failed". All or nothing. A lot of times records saved together depend on each other, so updating one record but failing on another isn't acceptable in normal circumstances. The client will get confused in this case because the Save failed, so reattempting to Save would result in attempting to insert the new record again, even though it was successfully saved the first time.
That being said, if you feel we should include an option to do this, please log it as a suggestion using our connect site: https://connect.microsoft.com/site1231.
Eric
- Proposed as answer by Eric ErhardtMicrosoft employee, Moderator Tuesday, March 20, 2012 9:20 PM
- Marked as answer by Mike Hole Wednesday, March 21, 2012 9:35 AM
Tuesday, March 20, 2012 9:20 PMModerator
All replies
-
Hi Mike-
I'm interested to know what external OData data source you're using - is it one that is publicly available or your own?
Also, what error are you seeing when you do an update?
Thanks,
NicoleTuesday, March 20, 2012 8:36 PM -
Currently there is no supported way to make LightSwitch send separate requests for each update to the data source. The reasoning for this is because you want transaction semantics as much as possible. Say you had 2 changes: a new record and an updated record. When the client saves, it expects the whole change set to succeed or to fail. There is no notion of "the insert succeeded, but the update failed". All or nothing. A lot of times records saved together depend on each other, so updating one record but failing on another isn't acceptable in normal circumstances. The client will get confused in this case because the Save failed, so reattempting to Save would result in attempting to insert the new record again, even though it was successfully saved the first time.
That being said, if you feel we should include an option to do this, please log it as a suggestion using our connect site: https://connect.microsoft.com/site1231.
Eric
- Proposed as answer by Eric ErhardtMicrosoft employee, Moderator Tuesday, March 20, 2012 9:20 PM
- Marked as answer by Mike Hole Wednesday, March 21, 2012 9:35 AM
Tuesday, March 20, 2012 9:20 PMModerator -
Hi Nicole,
It's the OData Service for TFS:
I have sent an email to the people responsible for the service to see if I can attack the problem from the other side (get the service to support the $batch operation).
I am sure you can imagine the cool stuff that would be possible with LightSwitch hooked up to TFS!
Tuesday, March 20, 2012 9:33 PM -
Hi Erick,
Thanks for your reply.
I will make the suggestion as I feel that not all OData data sources will implement the batch updates operations and it will limit the usefulness of having such an open way of reading and writing data.
Regards,
Mike
Tuesday, March 20, 2012 9:36 PM -
Perhaps you can create a custom WCF RIA service to sit in front of the external OData source. Then you can accept the batch call then pass each update to the OData Service for TFS.
Wednesday, March 21, 2012 2:38 AM -
Mike,
I was recently also considering to try the ODATA with TFS. I think there is a huge (market) potential in the duo Lightswitch + TFS.
Currently, TFS is most of the time consumed (of course apart from visual studio) by Sharepoint, but to be honest, I don't like that too much.
I think it would be great if Lightswitch could consume TFS Odata without any trouble.
paul van bladel
Wednesday, March 21, 2012 8:42 AM -
I think attacking this from the TFS OData service side is going to be my only option. I am going to have to get on to some of the dev champs in the UK to get an answer out of the guys responsable for the OData service.
Wednesday, March 21, 2012 9:38 AM -
Nice postsSunday, June 10, 2012 3:58 PM