using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Metadata; namespace SimpleModelsAndRelations.Models { public class User { public int Id { get; set; } public string Name { get; set; } public List Orders { get; set; } } public class Order { public int Id { get; set; } public DateTime Date { get; set; } public int UserId { get; set; } public User User { get; set; } public List Order_Product { get; set; } } // TODO 3: complete the implementation below (1 pts) public class Order_Product { public int Quantity { get; set; } public int ProductId { get; set; } public Product Product { get; set; } public int OrderId { get; set; } public Order Order { get; set; } } public class Product { public int Id { get; set; } public string Name { get; set; } public float Price { get; set; } public List Order_Product { get; set; } } public partial class SimpleModelsAndRelationsContext : DbContext { // TODO 1: complete the implementation below (1 pt) public DbSet Users { get; set; } public DbSet Orders { get; set; } public DbSet Products { get; set; } public DbSet Order_Products { get; set; } public SimpleModelsAndRelationsContext(DbContextOptions options) : base(options) { } protected override void OnModelCreating(ModelBuilder modelBuilder) { // TODO 2: complete the implementation below (0.5 pts) modelBuilder.Entity().HasKey(_op => new { _op.ProductId, _op.OrderId }); } } }