c# - Loading multiple RIA Services queries at same time -


i want similar below loading in parallel related data each of collection of loaded entities:

    foreach (var parentthing in parentthings)     {         context.load(context.getchildthingforparentquery(parentthing.id), op =>             {                 parentthing.child = op.entities.firstordefault();             }, null);     } 

however, doesn't seem work. data mixed in callback lambda, e.g. parentthing last object in collection , op.entities contains first child.

the problem foreach caused accessing modified closure. try:

foreach (var temp in parentthings)  {     var parentthing = temp;     context.load(context.getchildthingforparentquery(parentthing.id), op =>         {             parentthing.child = op.entities.firstordefault();         }, null); } 

Comments

Popular posts from this blog

haskell - Using filter on an item in a list? -

tomcat6 - Exception when stopping container for a with Spring + Quartz + Tomcat web application -

c# - Binding attached property to IEnumerable -