You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

45 lines
1.4 KiB

using Microsoft.EntityFrameworkCore;
using TenantManagement.Api.DDD.Domain.Entites;
namespace TenantManagement.Api.EF
{
public partial class TenantManagementContext : DbContext
{
public TenantManagementContext()
{
}
public TenantManagementContext(DbContextOptions<TenantManagementContext> options)
: base(options)
{
}
public virtual DbSet<Tenant> Tenant { get; set; }
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
if (!optionsBuilder.IsConfigured)
{
optionsBuilder.UseMySql("data source=127.0.0.1;initial catalog=TenantManagement;user id=root;password=pwd123456", Microsoft.EntityFrameworkCore.ServerVersion.Parse("8.0.28-mysql"));
}
}
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.UseCollation("utf8mb4_0900_ai_ci")
.HasCharSet("utf8mb4");
modelBuilder.Entity<Tenant>(entity =>
{
entity.HasComment("租户表");
entity.Property(e => e.Id).HasComment("主键Id");
entity.Property(e => e.CreationTime).HasComment("创建时间");
entity.Property(e => e.TenantName).HasComment("租户名称");
});
}
}
}