• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Convenience functions in model classes
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Convenience functions in model classes


  • Subject: Re: Convenience functions in model classes
  • From: Alexander Spohr <email@hidden>
  • Date: Sat, 5 Apr 2008 13:24:55 +0200


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 (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Follow-Ups:
    • Re: Convenience functions in model classes
      • From: Mike Schrag <email@hidden>
References: 
 >Convenience functions in model classes (From: Jeff Schmitz <email@hidden>)

  • Prev by Date: Re: WODirectConnectEnabled=false again
  • Next by Date: Re: Convenience functions in model classes
  • Previous by thread: Convenience functions in model classes
  • Next by thread: Re: Convenience functions in model classes
  • Index(es):
    • Date
    • Thread