2019-10-04 16:14:04 -04:00

18 lines
507 B
C#

using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace DataLayer.Configurations
{
internal class SupplementConfig : IEntityTypeConfiguration<Supplement>
{
public void Configure(EntityTypeBuilder<Supplement> entity)
{
entity.HasKey(s => s.SupplementId);
entity
.HasOne(s => s.Book)
.WithMany(b => b.Supplements)
.HasForeignKey(s => s.BookId);
}
}
}