I'm trying to create a tennis tournament application. I'm strugging to find a way to accomodate results for singles and doubles without creating two tables.
I was wondering whether something like the following could be accomplished?
public class Result
{
public int ResultId { get; set; }
public int TournamentId { get; set; }
public int Round { get; set; }
public DateTime? DatePlayed { get; set; }
public bool? Completed { get; set; }
}
public class ResultSingle : Result
{
public int Player1Id { get; set; }
public int Player1Score { get; set; }
public int Player2Id { get; set; }
public int Player2Score { get; set; }
}
public class ResultDouble : Result
{
public int Double1Id{ get; set; }
public int Double1Score { get; set; }
public int Double2Id { get; set; }
public int Double2Score { get; set; }
}
So then when I query Singles results it will query the Player table and when I query Doubles results it will look for Double Partners.
Is this right or would making it abstract make more sense?