public class Payment
{
[Key]
public int Payment_ID { get; set; }
[Required]
public decimal Amount { get; set; }
[Required]
public DateTime Payment_Date { get; set; }
public int Contract_ID { get; set; }
[ForeignKey(nameof(Contract_ID))]
public Contract Contract { get; set; }
public int Payment_Type_ID { get; set; }
[ForeignKey(nameof(Payment_Type_ID))]
public Payment_Type Payment_Type { get; set; }
}
//appDbContext
var Payments = new Payment[]
{
new Payment { Payment_ID = 1, Amount = 50.00m, Payment_Date = new DateTime(2024, 4, 12), Contract_ID = 1, Payment_Type_ID = 1 }
};
builder.Entity<Payment>().HasData(Payments);
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter