View Full Version : Core Data Model Help

Sep 12, 2012, 12:37 PM
I am having some trouble finding the best way to set up my Core Data Model... Let me explain my current situation...

I have three entities


The Team is set up as a one to many with Player and Game. (Each team has players and games played)
The Player is set up as a one to many with Game. (So I can show all the games that player has played in)

Each Player scores points,and various other stats during a Game. The Team has properties such as "teamGamePoints" that correspond to all that teams players stats combined during the current game. So for example if player 1 scores two points and player 2 scores three points, the teamPoints would be 5.

My question is How do I set up the model to support all the properties on the Player and Team entity such as playerGamePoints, and teamGamePoints specific to the game that it was played in? So I could look through the database of a Team or Player find all of its games, and that Entities stats during that specific game.

My Problem now is where do I put the stat properties, teamGamePoints and playerGamePoints?

Sep 12, 2012, 02:30 PM
Sounds like you actually have some many-to-many relationships and those are usually modeled in a separate table (with the two table ids as compound-primary and the other properties as attributes).