New Posts New Posts RSS Feed: POCO Problem
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

POCO Problem

 Post Reply Post Reply
Author
pharry View Drop Down
Newbie
Newbie
Avatar

Joined: 08-Jul-2009
Location: Sydney
Posts: 2
Post Options Post Options   Quote pharry Quote  Post ReplyReply Direct Link To This Post Topic: POCO Problem
    Posted: 08-Jul-2009 at 4:19am
Hi,
I am trying to extend the POCO sample by adding a User class to the example.
 
I am getting the following error when making the executeasync call.
 
I have tried this:

_mgr.ExecuteQueryAsync<User>(_mgr.Users(), GotUsers, null);

and this:
 
var rq = new EntityQuery<User>("Users", _mgr);

rq.ExecuteAsync(GotUsers, null);

 
TIA
 
Error 19 'IdeaBlade.EntityModel.EntityQuery<AppWithPocos.Pocos.User>' does not contain a definition for 'ExecuteAsync' and the best extension method overload 'IdeaBlade.EntityModel.EntityQueryExtensions.ExecuteAsync<T>(IdeaBlade.EntityModel.IEntityQuery<T>, IdeaBlade.EntityModel.AsyncCompletedCallback<IdeaBlade.EntityModel.EntityFetchedEventArgs<T>>, object)' has some invalid arguments C:\Dev\Pocos\AppWithPocos\MainPage.xaml.cs 62 9 AppWithPocos
Error 20 Argument '2': cannot convert from 'method group' to 'IdeaBlade.EntityModel.AsyncCompletedCallback<IdeaBlade.EntityModel.EntityFetchedEventArgs<AppWithPocos.Pocos.User>>' C:\Dev\Pocos\AppWithPocos\MainPage.xaml.cs 62 25 AppWithPocos
Back to Top
kimj View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 09-May-2007
Posts: 1391
Post Options Post Options   Quote kimj Quote  Post ReplyReply Direct Link To This Post Posted: 10-Jul-2009 at 5:59pm
My guess is that the GotUsers method has the wrong signature.  To keep the compiler happy it should be:
   private void GotUsers(EntityFetchedEventArgs<User> args)
 
In case that's not it, here's a review of other things to look at:
 
1) The User class should be "shared" between the AppWithPocos and AppWithPocosWeb projects, just like the State class is in States.cs.
 
2) Make sure that the User class is "known" to DevForce.  There are several ways to do this, one is to have the class implement the marker interface IdeaBlade.EntityModel.IKnownType.
 
3) Define a GetUsers method in a service provider class.  The easiest place to do this is within the PocoServiceProvider class in the sample.  The method should return an IEnumerable<User>.
 
4) Since you tried a Users() extension method, it should be defined like so:
      public static EntityQuery<User> Users(this EntityManager em) {
         return new EntityQuery<User>("Users", em);
      }
5) The callback defined in the ExecuteQueryAsync or ExecuteAsync call should have the correct signature (as shown above).
 
 
 
Back to Top
pharry View Drop Down
Newbie
Newbie
Avatar

Joined: 08-Jul-2009
Location: Sydney
Posts: 2
Post Options Post Options   Quote pharry Quote  Post ReplyReply Direct Link To This Post Posted: 12-Jul-2009 at 8:00pm
Hi Kim,
 
Thanks for the reply. After checking your suggestions I found I was returning  IEnumerable<State> rather than IEnumerable<User> in my GetUses procedure, you need to be careful when copying code :-).
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down