Files
Atomx/Atomx.Data/DataContext.cs
2025-12-23 12:26:25 +08:00

190 lines
5.1 KiB
C#

using Atomx.Common.Entities;
using Microsoft.EntityFrameworkCore;
namespace Atomx.Data
{
public class DataContext : DbContext
{
//add-migration 0.1 // add-migration 0.1 -Context DataContext
//update-database // update-database -Context DataContext
//Remove-Migration // Remove-Migration -Context DataContext
public DataContext(DbContextOptions options) : base(options)
{
}
protected DataContext()
{
}
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
}
protected override void OnModelCreating(ModelBuilder builder)
{
base.OnModelCreating(builder);
builder.Entity<Currency>(entity =>
{
entity.Property(e => e.Id).ValueGeneratedOnAdd();
});
}
/// <summary>
/// 用户地址信息
/// </summary>
public DbSet<Address> Addresses { get; set; }
/// <summary>
/// Admin 帐号
/// </summary>
public DbSet<Admin> Admins { get; set; }
/// <summary>
/// 应用版本记录
/// </summary>
public DbSet<AppVersion> AppVersions { get; set; }
/// <summary>
/// 国家省市地区
/// </summary>
public DbSet<Area> Areas { get; set; }
/// <summary>
/// 分类
/// </summary>
public DbSet<Category> Categories { get; set; }
/// <summary>
/// 系统通道
/// </summary>
public DbSet<Channel> Channels { get; set; }
/// <summary>
/// 货币信息
/// </summary>
public DbSet<Currency> Currencies { get; set; }
/// <summary>
/// 货币与支付通道关联表
/// </summary>
public DbSet<CurrencyChannelRelation> CurrencyChannelRelations { get; set; }
/// <summary>
/// 本地化资源数据
/// </summary>
public DbSet<LocaleResource> LocaleResources { get; set; }
/// <summary>
/// 多语言数据本地化数据
/// </summary>
public DbSet<LocalizedProperty> LocalizedProperties { get; set; }
/// <summary>
/// 权限信息
/// </summary>
public DbSet<Permission> Permissions { get; set; }
/// <summary>
/// 产品信息
/// </summary>
public DbSet<Product> Products { get; set; }
/// <summary>
/// 产品属性组合信息
/// </summary>
public DbSet<ProductAttributeCombination> ProductAttributeCombinations { get; set; }
/// <summary>
/// 产品属性值
/// </summary>
public DbSet<ProductAttributeOption> ProductAttributeOptions { get; set; }
/// <summary>
/// 产品属性值
/// </summary>
public DbSet<ProductAttributeValue> ProductAttributeValues { get; set; }
/// <summary>
/// 产品属性关系
/// </summary>
public DbSet<ProductAttributeRelation> ProductAttributeRelations { get; set; }
/// <summary>
/// 产品的属性值
/// </summary>
public DbSet<ProductAttribute> ProductAttributes { get; set; }
/// <summary>
/// 产品库存信息
/// </summary>
public DbSet<ProductInventory> ProductInventories { get; set; }
/// <summary>
/// 产品库存记录日志
/// </summary>
public DbSet<ProductInventoryLog> ProductInventoryLogs { get; set; }
/// <summary>
/// 产品的规格属性
/// </summary>
public DbSet<SpecificationAttribute> SpecificationAttributes { get; set; }
/// <summary>
/// 规格属性预设值
/// </summary>
public DbSet<SpecificationAttributeOption> SpecificationAttributeOptions { get; set; }
/// <summary>
/// 刷新Tokens
/// </summary>
public DbSet<RefreshToken> RefreshTokens { get; set; }
/// <summary>
/// 用户角色
/// </summary>
public DbSet<Role> Roles { get; set; }
/// <summary>
/// 系统配置
/// </summary>
public DbSet<Setting> Settings { get; set; }
/// <summary>
/// 网站应用
/// </summary>
public DbSet<SiteApp> SiteApps { get; set; }
/// <summary>
/// 多语言
/// </summary>
public DbSet<Language> Languages { get; set; }
/// <summary>
/// 消息模版
/// </summary>
public DbSet<MessageTemplate> MessageTemplates { get; set; }
/// <summary>
/// 后台功能菜单
/// </summary>
public DbSet<Menu> Menus { get; set; }
/// <summary>
/// 标签
/// </summary>
public DbSet<Tag> Tags { get; set; }
/// <summary>
/// 上传文件
/// </summary>
public DbSet<UploadFile> UploadFiles { get; set; }
/// <summary>
/// 用户基本信息
/// </summary>
public DbSet<User> Users { get; set; }
}
}