chore 重构数据库迁移逻辑并优化实体配置
This commit is contained in:
		| @ -1,4 +1,4 @@ | ||||
| using KonSoft.Admin.Entities; | ||||
| using KonSoft.Admin.EntityFrameworkCore.Configures; | ||||
| using Microsoft.EntityFrameworkCore; | ||||
| using Volo.Abp.AuditLogging.EntityFrameworkCore; | ||||
| using Volo.Abp.BackgroundJobs.EntityFrameworkCore; | ||||
| @ -41,6 +41,8 @@ public class AdminDbContext : | ||||
|         builder.ConfigureOpenIddict(); | ||||
|         builder.ConfigureFeatureManagement(); | ||||
|         builder.ConfigureTenantManagement(); | ||||
|  | ||||
|         builder.ConfigureApplication(); | ||||
|     } | ||||
|  | ||||
|     public DbSet<IdentityUser> Users { get; set; } | ||||
| @ -55,10 +57,4 @@ public class AdminDbContext : | ||||
|  | ||||
|     public DbSet<Tenant> Tenants { get; set; } | ||||
|     public DbSet<TenantConnectionString> TenantConnectionStrings { get; set; } | ||||
|  | ||||
|  | ||||
|     public DbSet<Order> Orders { get; set; } | ||||
|     public DbSet<ServiceCategory> ServiceCategories { get; set; } | ||||
|     public DbSet<HouseholdWorker> HouseholdWorkers { get; set; } | ||||
|  | ||||
| } | ||||
| @ -1,6 +1,6 @@ | ||||
| using System.Diagnostics.CodeAnalysis; | ||||
| using KonSoft.Admin.Entities; | ||||
| using KonSoft.Admin.Entities; | ||||
| using Microsoft.EntityFrameworkCore; | ||||
| using System.Diagnostics.CodeAnalysis; | ||||
| using Volo.Abp; | ||||
|  | ||||
| namespace KonSoft.Admin.EntityFrameworkCore.Configures; | ||||
| @ -15,20 +15,23 @@ public static class ApplicationDbContextModelBuilderExtensions | ||||
|         { | ||||
|             b.ToTable(AdminConsts.DbTablePrefix + nameof(Order) + AdminConsts.DbSchema); | ||||
|  | ||||
|             b.OwnsOne(o => o.Address, a => | ||||
|             { | ||||
|                 a.Property(p => p.ContactName).HasColumnName("ContactName").HasMaxLength(50); | ||||
|                 a.Property(p => p.ContactPhone).HasColumnName("ContactPhone").HasMaxLength(20); | ||||
|                 a.Property(p => p.DetailAddress).HasColumnName("DetailAddress").HasMaxLength(200); | ||||
|                 a.Property(p => p.City).HasColumnName("City").HasMaxLength(50); | ||||
|                 a.Property(p => p.District).HasColumnName("District").HasMaxLength(50); | ||||
|             }); | ||||
|             b.ComplexProperty(e => e.Address); | ||||
|         }); | ||||
|  | ||||
|         builder.Entity<Product>(b => | ||||
|         { | ||||
|             b.ToTable(AdminConsts.DbTablePrefix + nameof(Product) + AdminConsts.DbSchema); | ||||
|         }); | ||||
|  | ||||
|         builder.Entity<HouseholdWorker>(b => | ||||
|         { | ||||
|             b.ToTable(AdminConsts.DbTablePrefix + nameof(HouseholdWorker) + AdminConsts.DbSchema); | ||||
|         }); | ||||
|  | ||||
|         builder.Entity<ServiceCategory>(b => | ||||
|         { | ||||
|             b.ToTable(AdminConsts.DbTablePrefix + nameof(ServiceCategory) + AdminConsts.DbSchema); | ||||
|         }); | ||||
|  | ||||
|     } | ||||
| } | ||||
		Reference in New Issue
	
	Block a user