using Hncore.Infrastructure.EF; using Microsoft.AspNetCore.Http; using Microsoft.EntityFrameworkCore; using System; namespace Hncore.Pass.OSS.Domain { public partial class CourseContext : DbContextBase { IHttpContextAccessor _httpContextAccessor; /// /// 构造函数 /// /// 上下文实体 /// http请求上下文 public CourseContext(DbContextOptions options, IHttpContextAccessor httpContextAccessor) : base(options, httpContextAccessor) { } public virtual DbSet Asset { get; set; } public virtual DbSet AssetGroup { get; set; } protected override void OnModelCreating(ModelBuilder modelBuilder) { modelBuilder.Entity(entity => { entity.ToTable("asset"); entity.HasKey(p => p.Id); entity.Property(e => e.Id).ValueGeneratedOnAdd(); }); modelBuilder.Entity(entity => { entity.ToTable("asset_group"); entity.HasKey(p => p.Id); entity.Property(e => e.Id).ValueGeneratedOnAdd(); }); base.OnModelCreating(modelBuilder); } } }