using Company.Domain.RewardAgg; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Metadata.Builders; using System; using _0_Framework.Application; using CompanyManagment.App.Contracts.Reward.Enums; namespace CompanyManagment.EFCore.Mapping; public class RewardMapping:IEntityTypeConfiguration { public void Configure(EntityTypeBuilder builder) { builder.ToTable("Rewards"); builder.HasKey(x => x.id); builder.Property(x=>x.IsActive).HasConversion( v => v.ToString(), v => (IsActive)Enum.Parse(typeof(IsActive), v)).HasMaxLength(5); builder.Property(x => x.Description).HasColumnType("ntext"); builder.Property(x => x.Title).HasMaxLength(255); builder.Property(x => x.RewardType).HasConversion().HasMaxLength(50); builder.Property(x => x.CreatedByUserType).HasConversion().HasMaxLength(50); builder.Property(x => x.LastModifiedByUserType).HasConversion().HasMaxLength(50); } }