Skip to content

Instantly share code, notes, and snippets.

@wullemsb
Created July 8, 2024 17:58
public class Product
{
public int Id { get; set;}
public decimal UnitPrice{ get; set;}
public Category Category { get; set;}
}
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