-
-
Save RyanABailey/a4eaf9e4d8447299738d to your computer and use it in GitHub Desktop.
Entity First Composite Key
This file contains hidden or 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
| public class Raffle | |
| { | |
| public int RaffleId { get; set; } | |
| public virtual List<Ticket> Tickets { get; set; } | |
| } | |
| public class Ticket | |
| { | |
| [Key, Column(Order = 0)] | |
| [DatabaseGenerated(DatabaseGeneratedOption.None)] | |
| public int TicketNumber { get; set; } | |
| [Key, ForeignKey("Raffle"), Column(Order = 1)] | |
| public int RaffleId { get; set; } | |
| public virtual Raffle Raffle { get; set; } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment