Files
2024-08-24 19:13:34 +03:30

26 lines
1.1 KiB
C#

using AccountManagement.Domain.TicketAgg;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace AccountMangement.Infrastructure.EFCore.Mappings;
public class TicketMapping:IEntityTypeConfiguration<Ticket>
{
public void Configure(EntityTypeBuilder<Ticket> builder)
{
builder.HasKey(x => x.id);
builder.ToTable("Tickets");
builder.Property(x => x.ContractingPartyName).HasMaxLength(155);
builder.Property(x => x.TicketType).HasMaxLength(50);
builder.Property(x => x.Title).HasMaxLength(200);
builder.Property(x => x.Description).HasColumnType("ntext");
builder.Property(x => x.Status).HasMaxLength(30);
builder.Property(x => x.TicketNumber).HasMaxLength(12);
builder.HasMany(x => x.ClientResponses).WithOne(x => x.Ticket).HasForeignKey(x => x.TicketId);
builder.HasMany(x => x.TicketMedias).WithOne(x => x.Ticket).HasForeignKey(x => x.MediaId);
builder.HasMany(x => x.AdminResponses).WithOne(x => x.Ticket).HasForeignKey(x => x.TicketId);
}
}