26 lines
917 B
C#
26 lines
917 B
C#
using System;
|
|
using _0_Framework.Application.Enums;
|
|
using Company.Domain.CheckoutAgg;
|
|
using Microsoft.EntityFrameworkCore;
|
|
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
|
|
|
namespace CompanyManagment.EFCore.Mapping;
|
|
|
|
public class CheckoutWarningMessageMapping : IEntityTypeConfiguration<CheckoutWarningMessage>
|
|
{
|
|
public void Configure(EntityTypeBuilder<CheckoutWarningMessage> builder)
|
|
{
|
|
builder.ToTable("CheckoutWarningMessage");
|
|
builder.HasKey(x => x.id);
|
|
|
|
builder.Property(x => x.WarningMessage).HasMaxLength(150);
|
|
|
|
builder.Property(x => x.TypeOfCheckoutWarning).HasConversion(
|
|
v => v.ToString(),
|
|
v => (TypeOfCheckoutWarning)Enum.Parse(typeof(TypeOfCheckoutWarning), v)).HasMaxLength(30);
|
|
|
|
builder.HasOne(x => x.Checkout)
|
|
.WithMany(x => x.CheckoutWarningMessageList)
|
|
.HasForeignKey(x => x.CheckoutId);
|
|
}
|
|
} |