birbmap/Birdmap.DAL/Entities/Configurations/UserConfiguration.cs
2020-10-31 15:57:19 +01:00

31 lines
814 B
C#

using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace Birdmap.DAL.Entities.Configurations
{
public class UserConfiguration : IEntityTypeConfiguration<User>
{
public void Configure(EntityTypeBuilder<User> builder)
{
builder.HasIndex(u => u.Name)
.IsUnique();
builder.Property(u => u.Name)
.IsRequired();
builder.Property(u => u.PasswordHash)
.IsRequired();
builder.Property(u => u.PasswordSalt)
.IsRequired();
builder.Property(u => u.Role)
.IsRequired();
builder.Property(u => u.IsFromConfig)
.HasDefaultValue(false)
.IsRequired();
}
}
}