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/UserConfiguration.cs

31 lines
968 B
C#
Raw Normal View History

2023-05-15 20:45:16 +03:00
using NG_2023_Kanban.DataLayer.Entities;
2023-05-11 23:20:46 +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-11 23:20:46 +03:00
{
public class UserConfiguration : IEntityTypeConfiguration<User>
{
public void Configure(EntityTypeBuilder<User> builder)
{
builder.HasIndex(x => x.Id);
builder.Property(x => x.Id).IsRequired();
builder.Property(x => x.FullName).IsRequired();
builder.Property(x => x.FullName).HasMaxLength(100);
builder.HasIndex(x => x.Username).IsUnique(true);
builder.Property(x => x.Username).IsRequired();
builder.Property(x => x.Password).IsRequired();
builder
.HasMany(x => x.Boards)
.WithMany(x => x.Users);
2023-05-22 19:52:34 +03:00
builder
.HasMany(x => x.Roles)
.WithMany(x => x.Members);
2023-05-11 23:20:46 +03:00
}
}
}