- Add Fengling.Platform domain and infrastructure projects - Move Tenant aggregate from AuthService/Console to Platform.Domain - Add TenantRepository and SeedData to Platform - Remove duplicate Tenant/TenantInfo models from AuthService and Console - Update controllers and services to use Platform.Domain.Tenant - Add new migrations for PlatformDbContext BREAKING CHANGE: Tenant entity now uses strongly-typed ID (TenantId)
30 lines
1000 B
C#
30 lines
1000 B
C#
namespace Fengling.Platform.Infrastructure;
|
|
|
|
using Fengling.Platform.Domain.AggregatesModel.TenantAggregate;
|
|
using MediatR;
|
|
using Microsoft.EntityFrameworkCore;
|
|
using NetCorePal.Extensions.Repository.EntityFrameworkCore;
|
|
|
|
public partial class PlatformDbContext(DbContextOptions<PlatformDbContext> options, IMediator mediator)
|
|
: AppDbContextBase(options, mediator)
|
|
{
|
|
public DbSet<Tenant> Tenants => Set<Tenant>();
|
|
|
|
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
|
{
|
|
if (modelBuilder is null)
|
|
{
|
|
throw new ArgumentNullException(nameof(modelBuilder));
|
|
}
|
|
|
|
modelBuilder.ApplyConfigurationsFromAssembly(typeof(PlatformDbContext).Assembly);
|
|
base.OnModelCreating(modelBuilder);
|
|
}
|
|
|
|
protected override void ConfigureConventions(ModelConfigurationBuilder configurationBuilder)
|
|
{
|
|
ConfigureStronglyTypedIdValueConverter(configurationBuilder);
|
|
base.ConfigureConventions(configurationBuilder);
|
|
}
|
|
}
|