Stable multitenancy

This commit is contained in:
2026-09-24 10:25:07 +02:00
parent ef134a5b3c
commit 8e0c099867
54 changed files with 8900 additions and 603 deletions
@@ -1,12 +1,13 @@
namespace PostFundManagement.Domain.Entities;
[EntityTypeConfiguration<TenantUserConfiguration, TenantUser>]
public class TenantUser : Models.TenantUser
{
public virtual Tenant? Tenant { get; set; }
[ForeignKey(nameof(CreatedBy))]
public virtual User? Creator { get; set; }
[ForeignKey(nameof(UserId))]
public virtual User? User { get; set; }
}
@@ -17,6 +18,8 @@ public sealed class TenantUserConfiguration : IEntityTypeConfiguration<TenantUse
builder.ToTable(nameof(TenantUser).Pluralize());
builder.HasKey(pk => pk.Id);
builder.HasIndex(tu => new { tu.TenantId, tu.UserId }).IsUnique();
builder.Property(f => f.CreatedAt).IsRequired().HasDefaultValueSql("now()");
builder.Property(f => f.CreatedBy).IsRequired();
builder.Property(f => f.UserId).IsRequired();