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
Post a Comment