﻿using Abp.Zero.EntityFrameworkCore;
using Dxzh.Articles;
using Dxzh.Authorization.Roles;
using Dxzh.Authorization.Users;
using Dxzh.Banners;
using Dxzh.Downloads;
using Dxzh.EntityFrameworkCore.Extensions;
using Dxzh.Main;
using Dxzh.MultiTenancy;
using Dxzh.Pictures;
using Microsoft.EntityFrameworkCore;

namespace Dxzh.EntityFrameworkCore
{
    public class DxzhDbContext : AbpZeroDbContext<Tenant, Role, User, DxzhDbContext>
    {
        /* Define an IDbSet for each entity of the application */

        public DbSet<Picture> Pictures { get; set; }
        public DbSet<MainBanner> MainBanners { get; set; }
        public DbSet<Download> Downloads { get; set; }

        public DbSet<Banner> Banners { get; set; }
        public DbSet<Article> Articles { get; set; }

        public DxzhDbContext(DbContextOptions<DxzhDbContext> options)
            : base(options)
        {

        }

        protected override void OnModelCreating(ModelBuilder modelBuilder)
        {
            base.OnModelCreating(modelBuilder);
            AbpZeroDbModelBuilderExtensions.ChangeAbpTablePrefix<Tenant, Role, User>(modelBuilder, null);
            modelBuilder.Entity<Abp.Authorization.Users.UserToken>().ToTable("UserTokens");

            DxzhDbModelBuilderExtensions.ModelBuilderEntityTypeConfiguration(modelBuilder);
            //...
        }
    }
}
