misc
This commit is contained in:
parent
fbc6f562e3
commit
d7e0c59559
31 changed files with 249 additions and 57 deletions
|
@ -9,16 +9,23 @@ internal class UserIdentityTypeConfiguration : IEntityTypeConfiguration<UserIden
|
|||
public void Configure(EntityTypeBuilder<UserIdentity> builder)
|
||||
{
|
||||
builder.ToTable("user_identity");
|
||||
builder.OwnsOne(u => u.Password, pw =>
|
||||
{
|
||||
pw.Property(p => p.Hash)
|
||||
.HasColumnName("password_hash")
|
||||
.IsRequired(false);
|
||||
builder.OwnsOne(
|
||||
u => u.Password,
|
||||
pw =>
|
||||
{
|
||||
pw.Property(p => p.Hash).HasColumnName("password_hash").IsRequired(false);
|
||||
|
||||
pw.Property(p => p.Salt).HasColumnName("password_salt").IsRequired(false);
|
||||
}
|
||||
);
|
||||
|
||||
pw.Property(p => p.Salt)
|
||||
.HasColumnName("password_salt")
|
||||
.IsRequired(false);
|
||||
});
|
||||
builder.OwnsMany(u => u.Sessions).WithOwner().HasForeignKey("user_id");
|
||||
|
||||
builder
|
||||
.OwnsMany(u => u.Roles, entity =>
|
||||
{
|
||||
entity.WithOwner().HasForeignKey(x => x.UserId);
|
||||
entity.HasKey(x => new { x.UserId, x.Role});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue