Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
519 B
3
Indexable
Never
            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);