Am 05.04.2008 um 06:50 schrieb Jeff Schmitz:
Hello

As I get rolling down the EO highway, I find myself wanting to put convenience functions in the model classes that are generated by the EOGenerator (yes, I'm using the generation gap classes for this). e.g. to more closely mimic indexing a two dimensional array like the "old" way I used to do things, I create the following to retrieve a Game object from in from a model class that contains a one to many relationship to Game objects:

  public Game game(int group, int gameIndex) {
EOQualifier gameQual = Game.GROUP.eq(group).and(Game.GAMEINDEX.eq(gameIndex));
        Game game = this.games(gameQual).objectAtIndex(0);
        return game;
  }

Is this a good thing? Just hoping to get some feedback before I go too far down this road.

If you only want to have only one Game at all, yes.
If you are going to call this in a loop, no and never!

Remember that every call of this method goes into the database. That will kill your app. Better fetch all Games in memory and order them into an NSArray(NSAray()) and use that.

static public NSArray<NSArray<Games>>gameMatrix(EOEditingContext anEdCon)
{
        ...



        atze


_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to