Skip to main content
Bounty Ended with 50 reputation awarded by CommunityBot
suggested a simpler model
Source Link
Mathieu Guindon
  • 75.1k
  • 18
  • 191
  • 463

I would believe this simplified model could very well suit your needs:

http://yuml.me/edit/15eb9eca

The idea is to use the navigation properties to navigate between entities - from a business standpoint it makes sense for tournament matches to know what teams are involved, but from a data standpoint, it doesn't: when your application creates a new tournament, it also creates a TournamentMatchResult for all teams involved, with each team's score at 0 - and that's enough for a TournamentMatch to know what teams are playing.

As the game evolves, you can then update the TournamentMatchResult records, and if a TournamentMatch needs to know what teams are involved, it can easily find out by selecting its .TournamentMatchResults.Select(result => result.Team).

Notice this results in simple, easy-to-follow, one-to-many relationships everywhere.

I would believe this simplified model could very well suit your needs:

http://yuml.me/edit/15eb9eca

The idea is to use the navigation properties to navigate between entities - from a business standpoint it makes sense for tournament matches to know what teams are involved, but from a data standpoint, it doesn't: when your application creates a new tournament, it also creates a TournamentMatchResult for all teams involved, with each team's score at 0 - and that's enough for a TournamentMatch to know what teams are playing.

As the game evolves, you can then update the TournamentMatchResult records, and if a TournamentMatch needs to know what teams are involved, it can easily find out by selecting its .TournamentMatchResults.Select(result => result.Team).

Notice this results in simple, easy-to-follow, one-to-many relationships everywhere.

fixed [Tournament_Id:int] in class diagram
Source Link
Mathieu Guindon
  • 75.1k
  • 18
  • 191
  • 463

http://yuml.me/edit/570cc0ddhttp://yuml.me/edit/5090cace

http://yuml.me/edit/570cc0dd

http://yuml.me/edit/5090cace

added 384 characters in body
Source Link
Mathieu Guindon
  • 75.1k
  • 18
  • 191
  • 463

Let's look at the relationships. If I didn't make mistakes, this is what your code can be modeled as:

http://yuml.me/edit/570cc0dd

As @Jeroen explains, EF doesn't need junction tables to model a many-to-many relationship; PlayerTeamKey and TeamTournamentKey entities can be removed.


Let's look at the relationships. If I didn't make mistakes, this is what your code can be modeled as:

http://yuml.me/edit/570cc0dd

As @Jeroen explains, EF doesn't need junction tables to model a many-to-many relationship; PlayerTeamKey and TeamTournamentKey entities can be removed.

Source Link
Mathieu Guindon
  • 75.1k
  • 18
  • 191
  • 463
Loading