diff --git a/Data/ApplicationDbContext.cs b/Data/ApplicationDbContext.cs index 39ebe18..23b0f93 100644 --- a/Data/ApplicationDbContext.cs +++ b/Data/ApplicationDbContext.cs @@ -25,6 +25,14 @@ public class ApplicationDbContext : IdentityDbContext e.RealName).HasMaxLength(100); entity.Property(e => e.Phone).HasMaxLength(20); entity.HasIndex(e => e.Phone).IsUnique(); + + entity.OwnsOne(e => e.TenantInfo, navigationBuilder => + { + navigationBuilder.Property(e => e.Id).HasColumnName("TenantId"); + navigationBuilder.Property(e => e.TenantId).HasColumnName("TenantCode"); + navigationBuilder.Property(e => e.Name).HasColumnName("TenantName"); + navigationBuilder.WithOwner(); + }); }); builder.Entity(entity => diff --git a/Data/SeedData.cs b/Data/SeedData.cs index 351aaba..ab2ca0c 100644 --- a/Data/SeedData.cs +++ b/Data/SeedData.cs @@ -16,6 +16,7 @@ public static class SeedData context.Database.EnsureCreated(); var defaultTenant = await context.Tenants + .AsNoTracking() .FirstOrDefaultAsync(t => t.TenantId == "default"); if (defaultTenant == null) { diff --git a/Fengling.AuthService.csproj b/Fengling.AuthService.csproj index 30dfedf..9fb5156 100644 --- a/Fengling.AuthService.csproj +++ b/Fengling.AuthService.csproj @@ -6,25 +6,25 @@ - - + + all runtime; build; native; contentfiles; analyzers; buildtransitive - - - - - - - - - - - - - - + + + + + + + + + + + + + +