19 lines
659 B
C#
19 lines
659 B
C#
using AccountManagement.Domain.PositionAgg;
|
|
using Microsoft.EntityFrameworkCore;
|
|
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
|
|
|
namespace TaskManager.Infrastructure.EFCore.Mapping;
|
|
|
|
public class PositionMapping : IEntityTypeConfiguration<Position>
|
|
{
|
|
public void Configure(EntityTypeBuilder<Position> builder)
|
|
{
|
|
builder.ToTable("Positions");
|
|
builder.HasKey(x => x.id);
|
|
|
|
|
|
builder.Property(x => x.PositionName).HasMaxLength(50);
|
|
builder.Property(x => x.PositionValue).HasMaxLength(2);
|
|
builder.HasMany(x => x.Accounts).WithOne(x => x.Position).HasForeignKey(x => x.PositionId).IsRequired(false);
|
|
}
|
|
} |