2020-10-24 23:23:22 +02:00
|
|
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
|
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
|
|
|
|
|
|
|
|
|
namespace Birdmap.DAL.Entities.Configurations
|
|
|
|
|
{
|
|
|
|
|
public class UserConfiguration : IEntityTypeConfiguration<User>
|
|
|
|
|
{
|
|
|
|
|
public void Configure(EntityTypeBuilder<User> builder)
|
|
|
|
|
{
|
2020-10-25 16:15:06 +01:00
|
|
|
|
builder.HasIndex(u => u.Name)
|
|
|
|
|
.IsUnique();
|
|
|
|
|
|
2020-10-24 23:23:22 +02:00
|
|
|
|
builder.Property(u => u.Name)
|
|
|
|
|
.IsRequired();
|
|
|
|
|
|
|
|
|
|
builder.Property(u => u.PasswordHash)
|
|
|
|
|
.IsRequired();
|
|
|
|
|
|
|
|
|
|
builder.Property(u => u.PasswordSalt)
|
|
|
|
|
.IsRequired();
|
|
|
|
|
|
|
|
|
|
builder.Property(u => u.Role)
|
|
|
|
|
.IsRequired();
|
2020-10-25 16:15:06 +01:00
|
|
|
|
|
2020-10-31 15:57:19 +01:00
|
|
|
|
builder.Property(u => u.IsFromConfig)
|
|
|
|
|
.HasDefaultValue(false)
|
|
|
|
|
.IsRequired();
|
2020-10-24 23:23:22 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|