69 lines
2.5 KiB
C#
69 lines
2.5 KiB
C#
using System;
|
|
using Hncore.Infrastructure.EF;
|
|
using Microsoft.AspNetCore.Http;
|
|
using Microsoft.EntityFrameworkCore;
|
|
using Microsoft.EntityFrameworkCore.Metadata;
|
|
|
|
namespace Hncore.Pass.Sells.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)
|
|
{
|
|
}
|
|
|
|
public virtual DbSet<CouponEntity> SellCoupon { get; set; }
|
|
public virtual DbSet<CouponResourceEntity> SellCouponResource { get; set; }
|
|
public virtual DbSet<CouponUserOrginEntity> SellCouponUserOrgin { get; set; }
|
|
public virtual DbSet<CouponUserUseEntity> SellCouponUserUse { get; set; }
|
|
public virtual DbSet<TaoBaoOrderEntity> SellerTaoBao { get; set; }
|
|
|
|
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
|
{
|
|
modelBuilder.Entity<CouponEntity>(entity =>
|
|
{
|
|
entity.ToTable("sell_coupon");
|
|
entity.HasKey(p => p.Id);
|
|
entity.Property(e => e.Id).ValueGeneratedOnAdd();
|
|
});
|
|
|
|
modelBuilder.Entity<CouponResourceEntity>(entity =>
|
|
{
|
|
entity.ToTable("sell_coupon_resource");
|
|
entity.HasKey(p => p.Id);
|
|
entity.Property(e => e.Id).ValueGeneratedOnAdd();
|
|
});
|
|
|
|
modelBuilder.Entity<CouponUserOrginEntity>(entity =>
|
|
{
|
|
entity.ToTable("sell_coupon_user_orgin");
|
|
entity.HasKey(p => p.Id);
|
|
entity.Property(e => e.Id).ValueGeneratedOnAdd();
|
|
});
|
|
|
|
modelBuilder.Entity<CouponUserUseEntity>(entity =>
|
|
{
|
|
entity.ToTable("sell_coupon_user_use");
|
|
entity.HasKey(p => p.Id);
|
|
entity.Property(e => e.Id).ValueGeneratedOnAdd();
|
|
});
|
|
|
|
modelBuilder.Entity<TaoBaoOrderEntity>(entity =>
|
|
{
|
|
entity.ToTable("sell_taobao");
|
|
entity.HasKey(p => p.Id);
|
|
entity.Property(e => e.Id).ValueGeneratedOnAdd();
|
|
});
|
|
|
|
base.OnModelCreating(modelBuilder);
|
|
}
|
|
}
|
|
|
|
}
|