// using System; using GadgetsOnline.Models; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; #nullable disable namespace GadgetsOnline.Migrations { [DbContext(typeof(GadgetsOnlineEntities))] [Migration("20221010044739_InitialCreate")] partial class InitialCreate { protected override void BuildTargetModel(ModelBuilder modelBuilder) { #pragma warning disable 612, 618 modelBuilder .HasAnnotation("ProductVersion", "6.0.9") .HasAnnotation("Relational:MaxIdentifierLength", 128); SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1); modelBuilder.Entity("GadgetsOnline.Models.Cart", b => { b.Property("RecordId") .ValueGeneratedOnAdd() .HasColumnType("int"); SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("RecordId"), 1L, 1); b.Property("CartId") .HasColumnType("nvarchar(max)"); b.Property("Count") .HasColumnType("int"); b.Property("DateCreated") .HasColumnType("datetime2"); b.Property("ProductId") .HasColumnType("int"); b.HasKey("RecordId"); b.HasIndex("ProductId"); b.ToTable("Carts"); }); modelBuilder.Entity("GadgetsOnline.Models.Category", b => { b.Property("CategoryId") .ValueGeneratedOnAdd() .HasColumnType("int"); SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("CategoryId"), 1L, 1); b.Property("Description") .HasColumnType("nvarchar(max)"); b.Property("Name") .HasColumnType("nvarchar(max)"); b.HasKey("CategoryId"); b.ToTable("Categories"); }); modelBuilder.Entity("GadgetsOnline.Models.Order", b => { b.Property("OrderId") .ValueGeneratedOnAdd() .HasColumnType("int"); SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("OrderId"), 1L, 1); b.Property("Address") .IsRequired() .HasMaxLength(70) .HasColumnType("nvarchar(70)"); b.Property("City") .IsRequired() .HasMaxLength(40) .HasColumnType("nvarchar(40)"); b.Property("Country") .IsRequired() .HasMaxLength(40) .HasColumnType("nvarchar(40)"); b.Property("Email") .IsRequired() .HasColumnType("nvarchar(max)"); b.Property("FirstName") .IsRequired() .HasMaxLength(160) .HasColumnType("nvarchar(160)"); b.Property("LastName") .IsRequired() .HasMaxLength(160) .HasColumnType("nvarchar(160)"); b.Property("OrderDate") .HasColumnType("datetime2"); b.Property("Phone") .IsRequired() .HasMaxLength(24) .HasColumnType("nvarchar(24)"); b.Property("PostalCode") .IsRequired() .HasMaxLength(10) .HasColumnType("nvarchar(10)"); b.Property("State") .IsRequired() .HasMaxLength(40) .HasColumnType("nvarchar(40)"); b.Property("Total") .HasColumnType("decimal(18,2)"); b.Property("Username") .HasColumnType("nvarchar(max)"); b.HasKey("OrderId"); b.ToTable("Orders"); }); modelBuilder.Entity("GadgetsOnline.Models.OrderDetail", b => { b.Property("OrderDetailId") .ValueGeneratedOnAdd() .HasColumnType("int"); SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("OrderDetailId"), 1L, 1); b.Property("OrderId") .HasColumnType("int"); b.Property("ProductId") .HasColumnType("int"); b.Property("Quantity") .HasColumnType("int"); b.Property("UnitPrice") .HasColumnType("decimal(18,2)"); b.HasKey("OrderDetailId"); b.HasIndex("OrderId"); b.HasIndex("ProductId"); b.ToTable("OrderDetails"); }); modelBuilder.Entity("GadgetsOnline.Models.Product", b => { b.Property("ProductId") .ValueGeneratedOnAdd() .HasColumnType("int"); SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("ProductId"), 1L, 1); b.Property("CategoryId") .HasColumnType("int"); b.Property("Name") .IsRequired() .HasMaxLength(255) .HasColumnType("nvarchar(255)"); b.Property("Price") .HasColumnType("decimal(18,2)"); b.Property("ProductArtUrl") .HasMaxLength(1024) .HasColumnType("nvarchar(1024)"); b.HasKey("ProductId"); b.HasIndex("CategoryId"); b.ToTable("Products"); }); modelBuilder.Entity("GadgetsOnline.Models.Cart", b => { b.HasOne("GadgetsOnline.Models.Product", "Product") .WithMany() .HasForeignKey("ProductId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.Navigation("Product"); }); modelBuilder.Entity("GadgetsOnline.Models.OrderDetail", b => { b.HasOne("GadgetsOnline.Models.Order", "Order") .WithMany("OrderDetails") .HasForeignKey("OrderId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.HasOne("GadgetsOnline.Models.Product", "Product") .WithMany("OrderDetails") .HasForeignKey("ProductId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.Navigation("Order"); b.Navigation("Product"); }); modelBuilder.Entity("GadgetsOnline.Models.Product", b => { b.HasOne("GadgetsOnline.Models.Category", "Category") .WithMany("Products") .HasForeignKey("CategoryId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.Navigation("Category"); }); modelBuilder.Entity("GadgetsOnline.Models.Category", b => { b.Navigation("Products"); }); modelBuilder.Entity("GadgetsOnline.Models.Order", b => { b.Navigation("OrderDetails"); }); modelBuilder.Entity("GadgetsOnline.Models.Product", b => { b.Navigation("OrderDetails"); }); #pragma warning restore 612, 618 } } }