Created
March 7, 2018 10:33
-
-
Save anonymous/ceb3247cdd6483afecc6b3dfbc09865c to your computer and use it in GitHub Desktop.
Entity Framework
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for (var round = 1; round <= width; round++) | |
{ | |
// Round | |
var tournamentRound = new SingleKnockoutRound(); | |
tournamentRound.Tournament = this; | |
tournamentRound.Matches = new List<TournamentMatch>(); | |
dbContext.TournamentRounds.Add(tournamentRound); | |
this.Rounds.Add(tournamentRound); | |
for (var m = 0; m < nrOfMatches; m++) | |
{ | |
// TournamentMatch | |
var tournamentMatch = new TournamentMatch(); | |
dbContext.TournamentMatches.Add(tournamentMatch); | |
tournamentRound.Matches.Add(tournamentMatch); | |
// Match | |
var match = new Match(); | |
dbContext.Matches.Add(match); | |
tournamentMatch.Match = match; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment