Created
July 8, 2024 17:58
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Product | |
{ | |
public int Id { get; set;} | |
public decimal UnitPrice{ get; set;} | |
public Category Category { get; set;} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
internal class ProductMap : IEntityTypeConfiguration<Product> | |
{ | |
public void Configure(EntityTypeBuilder<Product> builder) | |
{ | |
builder.Property(x => x.Id).HasColumnName("ProductID"); | |
builder.Property(x=> x.UnitPrice); | |
builder.HasOne(x=> x.Category) | |
.WithMany(x=> x.Products) | |
.HasForeignKey("CategoryID"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment