Skip to main content
Home Forums Silverlight Programming Programming with .NET - General ADO.net data services/ BeginExecuteBatch
2 replies. Latest Post by lexius on April 16, 2009.
(0)
lexius
Member
33 points
115 Posts
01-15-2009 3:57 AM |
I have a few questions regarding ado.net dataservices, (in silverlight )
Currently I have 2 separate sections of code that run off and pull back data from my webservice, this works always ok for reading data. each section of code pulls back data from 2 unrelated tables. when changes are made and sent back i seem to get the following error below.
When i initially tested (adding, updating, deleting) it did work, but since then ive added the second table in and im getting an error(i did also get it once or twice initially with 1 table (i think anyway)), so;
"context already tracking a different entity with the same uri"
"The context is not currently tracking the entity." sometimes get this one
1. I am wondering if the error im getting is because I and using the uri to get two different entity sets back then trying to add, edit delete;
2. Either way I think i should be using (to reduce traffic) Batch requests anyway, to read the data and send back changes, would this solve my problem?
3. should i be using proxy.AttachTo(MyEntity) before using: proxy.AddToMyEntity(MyEntity) or proxy.UpdateObject(MyEntity) or proxy.DeleteObject(MyEntity)... Ive included a section of code below so you can see.
(i have looked at the few examples there are around, some seem to use it others dont)
4. I'm sure like me people I would like to create my application without resorting to silly work arounds, if batches are really the best way to do this in silverlight try searching goggle for: "BeginExecuteBatch"
pretty much nearly all the examples ive seen are with one table, so its hard to know if im doing things correctly
sample: c# code
private void dataHandlingBubbleAdd(Expander aBubble) { bs_bubble _bs_bubble = new bs_bubble(); Expander addBubble = (Expander)aBubble; try { _bs_bubble.bubbleName = addBubble.saveDataChanges[1, 2]; _bs_bubble.bubbleDesc = addBubble.saveDataChanges[1, 3]; proxy.AttachTo("bs_bubble", _bs_bubble); // when removed, I get the error: The context is not currently tracking the entity. proxy.AddTobs_bubble(_bs_bubble); saveResults(); tx_box2.Text = "added"; } catch (Exception ex) { tx_box1.Text += ex.Message; } }
}
Merrill ...
21 points
16 Posts
04-16-2009 4:11 PM |
I am getting the exact error with more than one table ..
did you ever get a work around?
I have blog lots of the Microsoft big names and have yet to get a reply ..
the attach works ok but I get an error on the save routine
04-16-2009 9:40 PM |
I posted in lots of places, and got no reply. seems like using entity model can be a bit risky, its got some very basic bugs, that should have been sorted before release. I think I get some code that managed to resolve this i think, i will try and find it in the next day or 2, and update this post.