Files
Backend-Api/CompanyManagment.EFCore/Mapping/SmsSettingMapping.cs
2025-11-15 12:21:18 +03:30

30 lines
828 B
C#

using System;
using _0_Framework.Application.Enums;
using Company.Domain.SmsResultAgg;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace CompanyManagment.EFCore.Mapping;
public class SmsSettingMapping : IEntityTypeConfiguration<SmsSetting>
{
public void Configure(EntityTypeBuilder<SmsSetting> builder)
{
builder.ToTable("SmsSettings");
builder.HasKey(x => x.id);
builder.Property(x => x.DayOfMonth)
.IsRequired();
builder.Property(x => x.TimeOfDay)
.HasColumnType("time(0)")
.IsRequired();
builder.Property(x => x.TypeOfSmsSetting).HasConversion(
v => v.ToString(),
v => (TypeOfSmsSetting)Enum.Parse(typeof(TypeOfSmsSetting), v)).HasMaxLength(30);
}
}