New Posts New Posts RSS Feed: Dynamic AsyncParallelTask?
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Dynamic AsyncParallelTask?

 Post Reply Post Reply
Author
davidklitzke View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 14-Jun-2007
Posts: 715
Post Options Post Options   Quote davidklitzke Quote  Post ReplyReply Direct Link To This Post Topic: Dynamic AsyncParallelTask?
    Posted: 28-Jul-2010 at 3:40pm
What part of this doesn’t work?
Each time you add an async query the return value is a new AsyncParallelTask.  So you can do this:
var asyncParallelTask = AsyncParallelTask.Create();
 
var t2 = asyncParallelTask.AddAsyncQuery(1, x => mgr.Customers);
var t3 = t2.AddAsyncQuery(2, x => mgr.Employees);
t3.Execute(…);
 
Back to Top
moflaherty View Drop Down
Newbie
Newbie
Avatar

Joined: 30-Apr-2010
Location: Akron, OH
Posts: 1
Post Options Post Options   Quote moflaherty Quote  Post ReplyReply Direct Link To This Post Posted: 28-Jul-2010 at 12:22pm
Is there a way to create AsyncParallelTask as a variable and then add queries to it? For example:
 
var asyncParallelTask = AsyncParallelTask.Create();
 
asyncParallelTask.AddAsyncQuery(1, x => mgr.Customers);
asyncParallelTask.AddAsyncQuery(2, x => mgr.Employees);
 
asyncParallelTask.Execute(cb => {
((EntityFetchedEventArgs <Customer>)cb.CompletionMap[1])
.Result.ForEach(c => Debug.WriteLine(c.CompanyName));
((EntityFetchedEventArgs <Employee>)cb.CompletionMap[2])
.Result.ForEach(e => Debug.WriteLine(e.LastName));
});
It would sure be nice to dynamically build these, so I want to ask before I give up on this approach. Obviously, the above does not work.
 
Thanks!
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down