using ODMO.Commons.DTOs.Assets; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Metadata.Builders; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; namespace ODMO.Infrastructure.ContextConfiguration.Assets { public class ArenaRankingDailyItemRewardsConfiguration : IEntityTypeConfiguration { public void Configure(EntityTypeBuilder builder) { builder .ToTable("ArenaDailyItemRewards", "Asset") .HasKey(x => x.Id); builder .Property(e => e.WeekDay) .HasColumnType("int") .HasConversion(new ValueConverter( x => (int)x, x => (DayOfWeek)x)) .IsRequired(); builder .HasMany(x => x.Rewards) .WithOne(x => x.Reward) .HasForeignKey(x => x.RewardId); } } }