Files
Backend-Api/AccountMangement.Infrastructure.EFCore/Mappings/MediaMapping.cs
2025-01-20 17:31:03 +03:30

23 lines
743 B
C#

using AccountManagement.Domain.MediaAgg;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace AccountMangement.Infrastructure.EFCore.Mappings;
public class MediaMapping : IEntityTypeConfiguration<Media>
{
public void Configure(EntityTypeBuilder<Media> builder)
{
builder.ToTable("Medias");
builder.HasKey(x => x.id);
builder.Property(x => x.Path).HasColumnType("ntext");
builder.Property(x => x.Type).HasMaxLength(10);
builder.Property(x => x.Category).HasMaxLength(10);
builder.Property(x => x.ServiceName).HasMaxLength(50);
builder.HasMany(x => x.TaskMedias).WithOne(x => x.Media).HasForeignKey(x => x.MediaId);
}
}