Untitled

 avatar
unknown
plain_text
3 years ago
519 B
8
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...