2023-07-29 10:19:42 +08:00
|
|
|
|
using Hncore.Infrastructure.EF;
|
|
|
|
|
|
using Microsoft.AspNetCore.Http;
|
|
|
|
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
|
|
|
|
|
|
|
|
namespace Hncore.Pass.Vpn.Domain
|
|
|
|
|
|
{
|
|
|
|
|
|
public partial class CourseContext : DbContextBase
|
|
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 构造函数
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="options">上下文实体</param>
|
|
|
|
|
|
/// <param name="httpContextAccessor">http请求上下文</param>
|
|
|
|
|
|
public CourseContext(DbContextOptions<CourseContext> options, IHttpContextAccessor httpContextAccessor) :
|
|
|
|
|
|
base(options, httpContextAccessor)
|
|
|
|
|
|
{
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
|
|
|
|
|
{
|
|
|
|
|
|
modelBuilder.Entity<ArticleEntity>(entity =>
|
|
|
|
|
|
{
|
|
|
|
|
|
entity.ToTable("article");
|
|
|
|
|
|
|
|
|
|
|
|
entity.HasKey(p => p.Id);
|
|
|
|
|
|
entity.Property(e => e.Id).ValueGeneratedOnAdd();
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
modelBuilder.Entity<ProductEntity>(entity =>
|
|
|
|
|
|
{
|
|
|
|
|
|
entity.ToTable("product");
|
|
|
|
|
|
|
|
|
|
|
|
entity.HasKey(p => p.Id);
|
|
|
|
|
|
entity.Property(e => e.Id).ValueGeneratedOnAdd();
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
modelBuilder.Entity<ProductAccountEntity>(entity =>
|
|
|
|
|
|
{
|
|
|
|
|
|
entity.ToTable("product_account");
|
|
|
|
|
|
|
|
|
|
|
|
entity.HasKey(p => p.Id);
|
|
|
|
|
|
entity.Property(e => e.Id).ValueGeneratedOnAdd();
|
|
|
|
|
|
entity.Ignore(e => e.RestTime);
|
|
|
|
|
|
entity.Ignore(e => e.RestDay);
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
modelBuilder.Entity<UserEntity>(entity =>
|
|
|
|
|
|
{
|
|
|
|
|
|
entity.ToTable("user");
|
|
|
|
|
|
|
|
|
|
|
|
entity.HasKey(p => p.Id);
|
|
|
|
|
|
entity.Property(e => e.Id).ValueGeneratedOnAdd();
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
modelBuilder.Entity<ProductPackageEntity>(entity =>
|
|
|
|
|
|
{
|
|
|
|
|
|
entity.ToTable("product_package");
|
|
|
|
|
|
|
|
|
|
|
|
entity.HasKey(p => p.Id);
|
|
|
|
|
|
entity.Property(e => e.Id).ValueGeneratedOnAdd();
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
modelBuilder.Entity<ProductOrderEntity>(entity =>
|
|
|
|
|
|
{
|
|
|
|
|
|
entity.ToTable("product_order");
|
|
|
|
|
|
|
|
|
|
|
|
entity.HasKey(p => p.Id);
|
|
|
|
|
|
entity.Property(e => e.Id).ValueGeneratedOnAdd();
|
|
|
|
|
|
});
|
|
|
|
|
|
modelBuilder.Entity<ProductOrderItemEntity>(entity =>
|
|
|
|
|
|
{
|
|
|
|
|
|
entity.ToTable("product_order_items");
|
|
|
|
|
|
|
|
|
|
|
|
entity.HasKey(p => p.Id);
|
|
|
|
|
|
entity.Property(e => e.Id).ValueGeneratedOnAdd();
|
|
|
|
|
|
});
|
|
|
|
|
|
modelBuilder.Entity<ProductUserPriceEntity>(entity =>
|
|
|
|
|
|
{
|
|
|
|
|
|
entity.ToTable("product_user_price");
|
|
|
|
|
|
|
|
|
|
|
|
entity.HasKey(p => p.Id);
|
|
|
|
|
|
entity.Property(e => e.Id).ValueGeneratedOnAdd();
|
|
|
|
|
|
});
|
|
|
|
|
|
modelBuilder.Entity<ProductPackageUnitEntity>(entity =>
|
|
|
|
|
|
{
|
|
|
|
|
|
entity.ToTable("product_package_unit");
|
|
|
|
|
|
|
|
|
|
|
|
entity.HasKey(p => p.Id);
|
|
|
|
|
|
entity.Property(e => e.Id).ValueGeneratedOnAdd();
|
|
|
|
|
|
});
|
|
|
|
|
|
modelBuilder.Entity<ProductAccountChargeEntity>(entity =>
|
|
|
|
|
|
{
|
|
|
|
|
|
entity.ToTable("product_account_recharge");
|
|
|
|
|
|
|
|
|
|
|
|
entity.HasKey(p => p.Id);
|
|
|
|
|
|
entity.Property(e => e.Id).ValueGeneratedOnAdd();
|
|
|
|
|
|
});
|
|
|
|
|
|
modelBuilder.Entity<ProductRouteEntity>(entity =>
|
|
|
|
|
|
{
|
|
|
|
|
|
entity.ToTable("product_route");
|
|
|
|
|
|
|
|
|
|
|
|
entity.HasKey(p => p.Id);
|
|
|
|
|
|
entity.Property(e => e.Id).ValueGeneratedOnAdd();
|
|
|
|
|
|
});
|
|
|
|
|
|
modelBuilder.Entity<WxAppUserEntity>(entity =>
|
|
|
|
|
|
{
|
|
|
|
|
|
entity.ToTable("wx_app_user");
|
|
|
|
|
|
|
|
|
|
|
|
entity.HasKey(p => p.Id);
|
|
|
|
|
|
entity.Property(e => e.Id).ValueGeneratedOnAdd();
|
|
|
|
|
|
});
|
|
|
|
|
|
modelBuilder.Entity<ProductPriceSchemeEntity>(entity =>
|
|
|
|
|
|
{
|
|
|
|
|
|
entity.ToTable("product_price_scheme");
|
|
|
|
|
|
|
|
|
|
|
|
entity.HasKey(p => p.Id);
|
|
|
|
|
|
entity.Property(e => e.Id).ValueGeneratedOnAdd();
|
|
|
|
|
|
});
|
|
|
|
|
|
modelBuilder.Entity<ProductPriceDiscountEntity>(entity =>
|
|
|
|
|
|
{
|
|
|
|
|
|
entity.ToTable("product_price_discount");
|
|
|
|
|
|
|
|
|
|
|
|
entity.HasKey(p => p.Id);
|
|
|
|
|
|
entity.Property(e => e.Id).ValueGeneratedOnAdd();
|
|
|
|
|
|
});
|
|
|
|
|
|
//代理
|
|
|
|
|
|
modelBuilder.Entity<AgentUserEntity>(entity =>
|
|
|
|
|
|
{
|
|
|
|
|
|
entity.ToTable("agent_user");
|
|
|
|
|
|
|
|
|
|
|
|
entity.HasKey(p => p.id);
|
|
|
|
|
|
entity.Property(e => e.id).ValueGeneratedOnAdd();
|
|
|
|
|
|
});
|
|
|
|
|
|
modelBuilder.Entity<AgentScoreEntity>(entity =>
|
|
|
|
|
|
{
|
|
|
|
|
|
entity.ToTable("agent_score");
|
|
|
|
|
|
|
|
|
|
|
|
entity.HasKey(p => p.id);
|
|
|
|
|
|
entity.Property(e => e.id).ValueGeneratedOnAdd();
|
|
|
|
|
|
});
|
|
|
|
|
|
modelBuilder.Entity<AgentPriceEntity>(entity =>
|
|
|
|
|
|
{
|
|
|
|
|
|
entity.ToTable("agent_price");
|
|
|
|
|
|
|
|
|
|
|
|
entity.HasKey(p => p.id);
|
|
|
|
|
|
entity.Property(e => e.id).ValueGeneratedOnAdd();
|
|
|
|
|
|
});
|
2024-04-17 15:04:57 +08:00
|
|
|
|
|
|
|
|
|
|
//上传tx认证
|
|
|
|
|
|
modelBuilder.Entity<AgreementEntity>(entity =>
|
|
|
|
|
|
{
|
|
|
|
|
|
entity.ToTable("use_agreement");
|
|
|
|
|
|
|
|
|
|
|
|
entity.HasKey(p => p.id);
|
|
|
|
|
|
entity.Property(e => e.id).ValueGeneratedOnAdd();
|
|
|
|
|
|
});
|
2023-07-29 10:19:42 +08:00
|
|
|
|
base.OnModelCreating(modelBuilder);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|