New Posts New Posts RSS Feed: Can't get AsyncSerialTask to work
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Can't get AsyncSerialTask to work

 Post Reply Post Reply
Author
downeytim View Drop Down
Newbie
Newbie


Joined: 08-Dec-2009
Location: Dallas, Texas
Posts: 18
Post Options Post Options   Quote downeytim Quote  Post ReplyReply Direct Link To This Post Topic: Can't get AsyncSerialTask to work
    Posted: 25-Mar-2010 at 7:11am
I have tried for several hours to get the examples in the help file for the AsyncSerialTask to work in a unit test.  It does not work.
 
Here is my code. It is take directly from the help file with some minor modification for my database objects
 
CypressEntityManager mgr = CypressEntityManager.DefaultManager;

var rootTask = AsyncSerialTask.Create<string>("Task1");

rootTask
.AddAsyncQuery((code) => mgr.Suffixes.Where(s => s.Code == code))
.AddAsyncQuery( (args) => args.Result.First())
.Execute("Jr", asyncSerCompletedHandler);
}

Here is the first error I get.
Error 203 The type arguments for method 'IdeaBlade.EntityModel.AsyncSerialTaskExtensions.AddAsyncQuery<T0,T1,T2>(IdeaBlade.EntityModel.AsyncSerialTask<T0,T1>, System.Func<T1,IdeaBlade.EntityModel.IEntityQuery<T2>>)' cannot be inferred from the usage. Try specifying the type arguments explicitly. 
 
The error is in reference to the first AddAsyncQuery line.  I have tried many different forms of this code and cannot get it working at all.  Unless someone can show me how to do this simple thing I can't see using this as much as I would like to.
 
We need a lot more examples of this type of advanced object in the help or sample applications that use these types of calls in various configurations.
 
Back to Top
ting View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 27-Mar-2009
Location: San Francisco
Posts: 427
Post Options Post Options   Quote ting Quote  Post ReplyReply Direct Link To This Post Posted: 25-Mar-2010 at 6:18pm
Hi Tim,
 
The "args => args.Result.First()" expression is not a query (which is where the argument mismatch is coming from) and doesn't need to be chained asynchronously.  You can write it without it and just take args.Result.First() in your handler:
 
rootTask
.AddAsyncQuery((code) => mgr.Suffixes.Where(s => s.Code == code))
.Execute("Jr", asyncSerCompletedHandler);  // do args.Result.First() in the handler

You can also write the handler inline with the Execute() if you don't want to define a separate method for it.
 
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down