Files
Backend-Api/CompanyManagment.EFCore/Mapping/WorkshopSubAccountMapping.cs

22 lines
690 B
C#

using Company.Domain.WorkshopSubAccountAgg;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace CompanyManagment.EFCore.Mapping
{
public class WorkshopSubAccountMapping : IEntityTypeConfiguration<WorkshopSubAccount>
{
public void Configure(EntityTypeBuilder<WorkshopSubAccount> builder)
{
builder.ToTable("WorkshopSubAccounts");
builder.HasKey(x => new { x.SubAccountId, x.WorkshopId });
builder.Property(x => x.IsActive).HasMaxLength(5);
builder.HasOne(x => x.Workshop).WithMany(x => x.WorkshopSubAccounts).HasForeignKey(x => x.WorkshopId);
}
}
}