ios - Make relationship in CoreData -


i have player entity , game entity.

one player many games relationships.

so player has position attribute

  • offense
  • defense

when create player , add player team set position offense or defense.

but different game player can have offense position or defense position , position can't overwritten player in team. if created player number 10 position offense can't modified, because each player in team have appropriated position. game can set new position player if want. suppose game id = 10 have player id = 7 has position = offense, want player player id = 7 have position defense game id = 12.

for game id 10 have position offense player

game id = 10 player.id = 7 player.position = offense 

for game id 12 have position defense same player

game id = 12 player.id = 7 player.position = defense 

so can see use different game use same player , if set new parameter player.position override previous value that's no because store latest position , when fetch players have players have last modified positions.

i suppose make in next way:

i have player entities, make different position each player in cornet game, have copy entity , set position want, problem there that's duplicate players , not good, because better way use same player (the 1 player) each game , have object save parameters of concrete game concrete player.

does make sense? or maybe need approach solve issue. in case think best way have not duplicated player.

my solution these case should this

game id = 10 player.id = 7 playerskill.position = offense playerskill.idplayer = 7  playerskill.speed = 9  player id name nationality ...  playerskill position idplayer speed .... 

so have each game player skills, , can create new games same player , create new skills


Comments

Popular posts from this blog

c# - How to get the current UAC mode -

postgresql - Lazarus + Postgres: incomplete startup packet -

javascript - Ajax jqXHR.status==0 fix error -