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

Cursor error with postgresql, pgpool and php -

delphi - ESC/P programming! -

c++ - error: use of deleted function -