Untitled

Anonymous
plain_text
05/06/2022 6:07 PM
692 B
24
Indexable
            modelBuilder.Entity<ProductCategory>()
                .HasKey(pc => new { pc.CategoryId, pc.ProductId });

            modelBuilder.Entity<ProductCategory>()
                .HasOne<Product>(p => p.Product)
                .WithMany(c => c.Category)
                .HasForeignKey(f => f.ProductId);

            modelBuilder.Entity<CourseStudent>()
                .HasOne<Category>(c => c.Category)
                .WithMany(p => p.Product)
                .HasForeignKey(f => f.CategoryId);
Editor is loading...