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/EntityConfiguration/UserConfiguration.cs
Stanislav Mykhailenko 0d47f075db
Initial commit
2023-05-11 23:29:33 +03:00

28 lines
905 B
C#

using NG_2023_Kanban.Entities;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace NG_2023_Kanban.EntityConfiguration
{
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.Property(x => x.IsAdmin).IsRequired();
builder
.HasMany(x => x.Boards)
.WithMany(x => x.Users);
}
}
}