This repository has been archived on 2024-10-24. You can view files and clone it, but cannot push or open issues or pull requests.
NG_2023_Kanban/NG_2023_Kanban.DataLayer/EntityConfiguration/ColumnConfiguration.cs

28 lines
891 B
C#
Raw Normal View History

2023-05-15 20:45:16 +03:00
using NG_2023_Kanban.DataLayer.Entities;
2023-05-14 19:54:40 +03:00
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
2023-05-15 20:45:16 +03:00
namespace NG_2023_Kanban.DataLayer.EntityConfiguration
2023-05-14 19:54:40 +03:00
{
public class ColumnConfiguration : IEntityTypeConfiguration<Column>
{
public void Configure(EntityTypeBuilder<Column> builder)
{
builder.HasIndex(x => x.Id);
builder.Property(x => x.Id).IsRequired();
builder.Property(x => x.Name).IsRequired();
builder.Property(x => x.Name).HasMaxLength(100);
builder.Property(x => x.Board).IsRequired();
builder.Property(x => x.Board).HasMaxLength(100);
builder
.HasOne(x => x.Board)
.WithMany(x => x.Columns)
.HasForeignKey(x => x.BoardId)
.HasPrincipalKey(x => x.Id);
}
}
}