Add Tenant basics

This commit is contained in:
2026-04-11 19:09:55 +09:30
parent 4ee8b9101d
commit df7b22235c
6 changed files with 18 additions and 3 deletions
@@ -12,8 +12,8 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
namespace Emergence.data.Migrations namespace Emergence.data.Migrations
{ {
[DbContext(typeof(AdminDbContext))] [DbContext(typeof(AdminDbContext))]
[Migration("20260401053644_test")] [Migration("20260407074950_CreateTenantTable")]
partial class test partial class CreateTenantTable
{ {
/// <inheritdoc /> /// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder) protected override void BuildTargetModel(ModelBuilder modelBuilder)
@@ -35,6 +35,10 @@ namespace Emergence.data.Migrations
.IsRequired() .IsRequired()
.HasColumnType("nvarchar(max)"); .HasColumnType("nvarchar(max)");
b.Property<string>("ConnectionString")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<bool>("IsInactive") b.Property<bool>("IsInactive")
.HasColumnType("bit"); .HasColumnType("bit");
@@ -6,7 +6,7 @@ using Microsoft.EntityFrameworkCore.Migrations;
namespace Emergence.data.Migrations namespace Emergence.data.Migrations
{ {
/// <inheritdoc /> /// <inheritdoc />
public partial class test : Migration public partial class CreateTenantTable : Migration
{ {
/// <inheritdoc /> /// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder) protected override void Up(MigrationBuilder migrationBuilder)
@@ -18,6 +18,7 @@ namespace Emergence.data.Migrations
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false), Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
TenantCode = table.Column<string>(type: "nvarchar(max)", nullable: false), TenantCode = table.Column<string>(type: "nvarchar(max)", nullable: false),
CompanyName = table.Column<string>(type: "nvarchar(max)", nullable: false), CompanyName = table.Column<string>(type: "nvarchar(max)", nullable: false),
ConnectionString = table.Column<string>(type: "nvarchar(max)", nullable: false),
IsInactive = table.Column<bool>(type: "bit", nullable: false) IsInactive = table.Column<bool>(type: "bit", nullable: false)
}, },
constraints: table => constraints: table =>
@@ -32,6 +32,10 @@ namespace Emergence.data.Migrations
.IsRequired() .IsRequired()
.HasColumnType("nvarchar(max)"); .HasColumnType("nvarchar(max)");
b.Property<string>("ConnectionString")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<bool>("IsInactive") b.Property<bool>("IsInactive")
.HasColumnType("bit"); .HasColumnType("bit");
+3
View File
@@ -16,8 +16,11 @@ namespace Emergence.data.Models
[Required] [Required]
public required string CompanyName { get; set; } public required string CompanyName { get; set; }
[Required]
public required string ConnectionString { get; set; }
[Required] [Required]
public required bool IsInactive { get; set; } public required bool IsInactive { get; set; }
} }
} }
+1
View File
@@ -9,5 +9,6 @@ public class TenantModel
public Guid? Id { get; set; } public Guid? Id { get; set; }
public string TenantCode { get; set; } public string TenantCode { get; set; }
public string CompanyName { get; set; } public string CompanyName { get; set; }
public string ConnectionString { get; set; }
public bool IsInactive { get; set; } public bool IsInactive { get; set; }
} }
@@ -19,6 +19,7 @@ public static class TenantExtension
TenantCode = tenant.TenantCode, TenantCode = tenant.TenantCode,
CompanyName = tenant.CompanyName, CompanyName = tenant.CompanyName,
IsInactive = tenant.IsInactive, IsInactive = tenant.IsInactive,
ConnectionString = tenant.ConnectionString
}; };
return model; return model;
} }
@@ -30,6 +31,7 @@ public static class TenantExtension
TenantCode = tenant.TenantCode, TenantCode = tenant.TenantCode,
CompanyName = tenant.CompanyName, CompanyName = tenant.CompanyName,
IsInactive = tenant.IsInactive, IsInactive = tenant.IsInactive,
ConnectionString = tenant.ConnectionString
}; };
return model; return model;
} }