using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;

#nullable disable

namespace Ropin.Inspection.Model.Entities
{
    public partial class InspectionDbContext : DbContext
    {
        public InspectionDbContext()
        {
        }

        public InspectionDbContext(DbContextOptions<InspectionDbContext> options)
            : base(options)
        {
        }
        public DatabaseFacade GetDatabase() => Database;
        /// <summary>
        /// create DbSet 
        /// </summary>
        /// <typeparam name="T">实体</typeparam>
        /// <returns></returns>
        public virtual DbSet<T> GetDbSet<T>() where T : class
        {
            if (Model.FindEntityType(typeof(T)) != null)
            {
                return Set<T>();
            }
            else
            {
                throw new Exception($"type {typeof(T).Name} is not add into DbContext ");
            }
        }
        public virtual DbSet<TMTN_DevOpsContent> TMTN_DevOpsContent { get; set; }
        public virtual DbSet<TMTN_SpotDevOpsContent> TMTN_SpotDevOpsContent { get; set; }
        public virtual DbSet<TMTN_DevOps> TMTN_DevOps { get; set; }
        public virtual DbSet<TMTN_DevOpsRecord> TMTN_DevOpsRecord { get; set; }
        public virtual DbSet<TMTN_DevOpsRecordApp> TMTN_DevOpsRecordApp { get; set; }
        public virtual DbSet<TMTN_DevOperateRecord> TMTN_DevOperateRecord { get; set; }
        public virtual DbSet<TMTN_DevOperateRecordApp> TMTN_DevOperateRecordApp { get; set; }
        public virtual DbSet<TMTN_RepairOrderItemApp> TMTN_RepairOrderItemApp { get; set; }
        public virtual DbSet<TMTN_RepairOrderItem> TMTN_RepairOrderItem { get; set; }
        public virtual DbSet<TMTN_RepairOrder> TMTN_RepairOrder { get; set; }
        public virtual DbSet<TMTN_PushMsgTo> TMTN_PushMsgTo { get; set; }
        public virtual DbSet<TMTN_PushMsgResult> TMTN_PushMsgResult { get; set; }
        public virtual DbSet<TDEV_DeviceArchives> TDEV_DeviceArchives { get; set; }
        public virtual DbSet<TDEV_DevSpot> TDEV_DevSpot { get; set; }

        public virtual DbSet<TDEV_DevOpeAccount> TDEV_DevOpeAccount { get; set; }

        public virtual DbSet<TBDM_Area> TBDM_Area { get; set; }
        public virtual DbSet<TBDM_City> TBDM_City { get; set; }
        public virtual DbSet<TBDM_CodeDetail> TBDM_CodeDetail { get; set; }
        public virtual DbSet<TBDM_CodeMain> TBDM_CodeMain { get; set; }
        public virtual DbSet<TBDM_Prov> TBDM_Prov { get; set; }
        public virtual DbSet<TDEV_DevAlert> TDEV_DevAlert { get; set; }
        public virtual DbSet<TDEV_DevAlertConfig> TDEV_DevAlertConfig { get; set; }
        public virtual DbSet<TDEV_DevDataConfig> TDEV_DevDataConfig { get; set; }
        public virtual DbSet<TDEV_DevData> TDEV_DevData { get; set; }
        public virtual DbSet<TDEV_Device> TDEV_Device { get; set; }
        public virtual DbSet<TDEV_DeviceTemplate> TDEV_DeviceTemplate { get; set; }


        public virtual DbSet<TDEV_BoxTemplate> TDEV_BoxTemplate { get; set; }
        public virtual DbSet<TDEV_Box> TDEV_Box { get; set; }
        public virtual DbSet<TDEV_BoxDevSpot> TDEV_BoxDevSpot { get; set; }
       

        public virtual DbSet<TDEV_DeviceTempArchives> TDEV_DeviceTempArchives { get; set; }
        public virtual DbSet<TDEV_MaintenanceKnowledge> TDEV_MaintenanceKnowledge { get; set; }
        public virtual DbSet<TDEV_MaintenanceTemplate> TDEV_MaintenanceTemplate { get; set; }
        public virtual DbSet<TDEV_MaintenancePlan> TDEV_MaintenancePlan { get; set; }
        public virtual DbSet<TDEV_DevStore> TDEV_DevStore { get; set; }
        public virtual DbSet<TDEV_DevStoreMigrate> TDEV_DevStoreMigrate { get; set; }
        public virtual DbSet<TDEV_DevStoreDoc> TDEV_DevStoreDoc { get; set; }
        public virtual DbSet<TDEV_DevStoreLog> TDEV_DevStoreLog { get; set; }
        public virtual DbSet<TDEV_DevicePart> TDEV_DevicePart { get; set; }
        public virtual DbSet<TDEV_DevicePartItem> TDEV_DevicePartItem { get; set; }
        public virtual DbSet<TDEV_WebScada> TDEV_WebScada { get; set; }
        public virtual DbSet<TDEV_WebScadaDevSpot> TDEV_WebScadaDevSpot { get; set; }

        public virtual DbSet<TISP_Content> TISP_Content { get; set; }
        public virtual DbSet<TISP_ContentGroup> TISP_ContentGroup { get; set; }
        public virtual DbSet<TISP_ContentGroupItem> TISP_ContentGroupItem { get; set; }
        public virtual DbSet<TISP_Record> TISP_Record { get; set; }
        public virtual DbSet<TISP_RecordImage> TISP_RecordImage { get; set; }
        public virtual DbSet<TISP_RecordItem> TISP_RecordItem { get; set; }
        public virtual DbSet<TISP_Report> TISP_Report { get; set; }
        public virtual DbSet<TISP_SecurityImage> TISP_SecurityImage { get; set; }
        public virtual DbSet<TISP_SecurityItem> TISP_SecurityItem { get; set; }
        public virtual DbSet<TISP_Spot> TISP_Spot { get; set; }
        public virtual DbSet<TISP_SpotContent> TISP_SpotContent { get; set; }
        public virtual DbSet<TISP_SpotUser> TISP_SpotUser { get; set; }
        public virtual DbSet<TPNT_Area> TPNT_Area { get; set; }
        public virtual DbSet<TPNT_Store> TPNT_Store { get; set; }
        public virtual DbSet<TPNT_StoreOrg> TPNT_StoreOrg { get; set; }
        public virtual DbSet<TPNT_Type> TPNT_Type { get; set; }
        public virtual DbSet<TPRD_Log> TPRD_Log { get; set; }
        public virtual DbSet<TPRD_ProdSKU> TPRD_ProdSKU { get; set; }
        public virtual DbSet<TPRD_Product> TPRD_Product { get; set; }
        public virtual DbSet<TPRD_Type> TPRD_Type { get; set; }
        public virtual DbSet<TSYS_License> TSYS_License { get; set; }
        public virtual DbSet<TSYS_LicenseType> TSYS_LicenseType { get; set; }
        public virtual DbSet<TSYS_LicenseTypePriv> TSYS_LicenseTypePriv { get; set; }
        public virtual DbSet<TSYS_Message> TSYS_Message { get; set; }
        public virtual DbSet<TSYS_MessageFile> TSYS_MessageFile { get; set; }
        public virtual DbSet<TSYS_Org> TSYS_Org { get; set; }
        public virtual DbSet<TSYS_Priv> TSYS_Priv { get; set; }
        public virtual DbSet<TSYS_Role> TSYS_Role { get; set; }
        public virtual DbSet<TSYS_RolePriv> TSYS_RolePriv { get; set; }
        public virtual DbSet<TSYS_User> TSYS_User { get; set; }
        public virtual DbSet<TSYS_UserRole> TSYS_UserRole { get; set; }
        public virtual DbSet<TSYS_Version> TSYS_Version { get; set; }
        public virtual DbSet<TaskInfoDto> TaskInfoDto { get; set; }
        public virtual DbSet<TasksQz> TasksQz { get; set; }

        public virtual DbSet<TSYS_UserPost> TSYS_UserPost { get; set; }
        public virtual DbSet<TISP_Region> TISP_Region { get; set; }
        public virtual DbSet<TSEC_Record> TSEC_Record { get; set; }
        //public virtual DbSet<TISP_SecurityItem> TSEC_RecordItem { get; set; }
        public virtual DbSet<TISP_SpotRegion> TISP_SpotRegion { get; set; }
        public virtual DbSet<TISP_Route> TISP_Route { get; set; }
        public virtual DbSet<TISP_SpotRoute> TISP_SpotRoute { get; set; }
        public virtual DbSet<TDEV_DeviceTempOpsContent> TDEV_DeviceTempOpsContent { get; set; }
        public virtual DbSet<TDEV_MaintenancePlanContent> TDEV_MaintenancePlanContent { get; set; }
        public virtual DbSet<TDEV_DevOpeAccountConfig> TDEV_DevOpeAccountConfig { get; set; }
        public virtual DbSet<TDEV_Hand> TDEV_Hand { get; set; }
        public virtual DbSet<TSYS_RoleHand> TSYS_RoleHand { get; set; }
        public virtual DbSet<TMTN_AlarmOrder> TMTN_AlarmOrder { get; set; }
        public virtual DbSet<TMTN_AlarmHandleRecord> TMTN_AlarmHandleRecord { get; set; }
        public virtual DbSet<TMTN_AlarmHandleRecordApp> TMTN_AlarmHandleRecordApp { get; set; }
        public virtual DbSet<TDEV_DevBoxMigrate> TDEV_DevBoxMigrate { get; set; }
        public virtual DbSet<TSYS_Login> TSYS_Login { get; set; }
        public virtual DbSet<TLGS_LargeScreenTemplate> TLGS_LargeScreenTemplate { get; set; }
        public virtual DbSet<TLGS_LargeScreen> TLGS_LargeScreen { get; set; }
        public virtual DbSet<TSYS_LicenseLargeScreenTemplate> TSYS_LicenseLargeScreenTemplate { get; set; }
        public virtual DbSet<TLGS_LargeScreenControl> TLGS_LargeScreenControl { get; set; }
        public virtual DbSet<TLGS_LargeScreenEvent> TLGS_LargeScreenEvent { get; set; }
        public virtual DbSet<TDEV_DevBox> TDEV_DevBox { get; set; }
        public virtual DbSet<TDEV_Cmd> TDEV_Cmd { get; set; }
        public virtual DbSet<TDEV_Instruction> TDEV_Instruction { get; set; }
        public virtual DbSet<TDEV_CmdInstruction> TDEV_CmdInstruction { get; set; }
        public virtual DbSet<TVMC_CameraTemplate> TVMC_CameraTemplate { get; set; }
        public virtual DbSet<TVMC_Camera> TVMC_Camera { get; set; }
        public virtual DbSet<TVMC_CameraMigrate> TVMC_CameraMigrate { get; set; }
        public virtual DbSet<TVMC_DevCamera> TVMC_DevCamera { get; set; }
        public virtual DbSet<TMTN_AlarmShadowRecord> TMTN_AlarmShadowRecord { get; set; }
        public virtual DbSet<TaicAiboxTemplate> TaicAiboxTemplates { get; set; }
        public virtual DbSet<TaicAibox> TaicAiboxes { get; set; }
        public virtual DbSet<TaicAiboxMigrate> TaicAiboxMigrates { get; set; }
        public virtual DbSet<TaicDevAibox> TaicDevAiboxes { get; set; }

        protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
        {
            if (!optionsBuilder.IsConfigured)
            {
#warning To protect potentially sensitive information in your connection string, you should move it out of source code. You can avoid scaffolding the connection string by using the Name= syntax to read it from configuration - see https://go.microsoft.com/fwlink/?linkid=2131148. For more guidance on storing connection strings, see http://go.microsoft.com/fwlink/?LinkId=723263.
                optionsBuilder.UseMySql("server=117.78.26.193;user id=root;password=Xhrz@2018;port=8635;persistsecurityinfo=True;database=SH_HB_Test;sslmode=None", Microsoft.EntityFrameworkCore.ServerVersion.FromString("5.7.21-mysql"));
            }
        }

        protected override void OnModelCreating(ModelBuilder modelBuilder)
        {
            modelBuilder.Entity<TBDM_Area>(entity =>
            {
                entity.HasKey(e => e.C_Code)
                    .HasName("PRIMARY");

                entity.ToTable("TBDM_Area");

                entity.HasIndex(e => e.C_CityCode, "FK_TBDM_Area_C_CityCode");

                entity.Property(e => e.C_Code)
                    .HasColumnType("varchar(20)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_CityCode)
                    .IsRequired()
                    .HasColumnType("varchar(20)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_Name)
                    .IsRequired()
                    .HasColumnType("varchar(50)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_Status)
                    .IsRequired()
                    .HasColumnType("char(1)")
                    .HasDefaultValueSql("'1'")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.I_Sort).HasColumnType("int(11)");

                entity.HasOne(d => d.C_CityCodeNavigation)
                    .WithMany(p => p.TBDM_Areas)
                    .HasForeignKey(d => d.C_CityCode)
                    .OnDelete(DeleteBehavior.ClientSetNull)
                    .HasConstraintName("FK_TBDM_Area_C_CityCode");
            });

            modelBuilder.Entity<TBDM_City>(entity =>
            {
                entity.HasKey(e => e.C_Code)
                    .HasName("PRIMARY");

                entity.ToTable("TBDM_City");

                entity.HasIndex(e => e.C_ProvCode, "FK_TBDM_City_C_ProvCode");

                entity.Property(e => e.C_Code)
                    .HasColumnType("varchar(20)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_Name)
                    .IsRequired()
                    .HasColumnType("varchar(50)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_ProvCode)
                    .IsRequired()
                    .HasColumnType("varchar(20)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_Status)
                    .IsRequired()
                    .HasColumnType("char(1)")
                    .HasDefaultValueSql("'1'")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.I_Sort).HasColumnType("int(11)");

                entity.HasOne(d => d.C_ProvCodeNavigation)
                    .WithMany(p => p.TBDM_Cities)
                    .HasForeignKey(d => d.C_ProvCode)
                    .OnDelete(DeleteBehavior.ClientSetNull)
                    .HasConstraintName("FK_TBDM_City_C_ProvCode");
            });

            modelBuilder.Entity<TBDM_CodeDetail>(entity =>
            {
                entity.HasKey(e => e.C_Code)
                    .HasName("PRIMARY");

                entity.ToTable("TBDM_CodeDetail");

                entity.HasIndex(e => e.C_CreateBy, "FK_TBDM_CodeDetail_C_CreateBy");

                entity.HasIndex(e => e.C_LastUpdatedBy, "FK_TBDM_CodeDetail_C_LastUpdatedBy");

                entity.HasIndex(e => e.C_MainCode, "FK_TBDM_CodeDetail_C_MainCode");

                entity.Property(e => e.C_Code)
                    .HasColumnType("varchar(50)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_CreateBy)
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_Default)
                    .IsRequired()
                    .HasColumnType("char(1)")
                    .HasDefaultValueSql("'0'")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_IsSys)
                    .IsRequired()
                    .HasColumnType("char(1)")
                    .HasDefaultValueSql("'0'")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_LastUpdatedBy)
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_MainCode)
                    .IsRequired()
                    .HasColumnType("varchar(50)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_Name)
                    .IsRequired()
                    .HasColumnType("varchar(50)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_Remark)
                    .HasColumnType("varchar(500)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_Status)
                    .IsRequired()
                    .HasColumnType("char(1)")
                    .HasDefaultValueSql("'1'")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_Value)
                    .IsRequired()
                    .HasColumnType("varchar(255)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.D_CreateOn).HasColumnType("datetime");

                entity.Property(e => e.D_LastUpdatedOn).HasColumnType("datetime");

                entity.Property(e => e.I_Sort).HasColumnType("int(11)");

                entity.HasOne(d => d.C_CreateByNavigation)
                    .WithMany(p => p.TBDM_CodeDetailC_CreateByNavigations)
                    .HasForeignKey(d => d.C_CreateBy)
                    .OnDelete(DeleteBehavior.ClientSetNull)
                    .HasConstraintName("FK_TBDM_CodeDetail_C_CreateBy");

                entity.HasOne(d => d.C_LastUpdatedByNavigation)
                    .WithMany(p => p.TBDM_CodeDetailC_LastUpdatedByNavigations)
                    .HasForeignKey(d => d.C_LastUpdatedBy)
                    .HasConstraintName("FK_TBDM_CodeDetail_C_LastUpdatedBy");

                entity.HasOne(d => d.C_MainCodeNavigation)
                    .WithMany(p => p.TBDM_CodeDetails)
                    .HasForeignKey(d => d.C_MainCode)
                    .OnDelete(DeleteBehavior.ClientSetNull)
                    .HasConstraintName("FK_TBDM_CodeDetail_C_MainCode");
            });

            modelBuilder.Entity<TBDM_CodeMain>(entity =>
            {
                entity.HasKey(e => e.C_Code)
                    .HasName("PRIMARY");

                entity.ToTable("TBDM_CodeMain");

                entity.HasIndex(e => e.C_CreateBy, "FK_TBDM_CodeMain_C_CreateBy");

                entity.HasIndex(e => e.C_LastUpdatedBy, "FK_TBDM_CodeMain_C_LastUpdatedBy");

                entity.Property(e => e.C_Code)
                    .HasColumnType("varchar(50)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_CreateBy)
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_LastUpdatedBy)
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_Name)
                    .IsRequired()
                    .HasColumnType("varchar(50)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_Remark)
                    .HasColumnType("varchar(500)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_Status)
                    .IsRequired()
                    .HasColumnType("char(1)")
                    .HasDefaultValueSql("'1'")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.D_CreateOn).HasColumnType("datetime");

                entity.Property(e => e.D_LastUpdatedOn).HasColumnType("datetime");

                entity.Property(e => e.I_Sort).HasColumnType("int(11)");

                entity.HasOne(d => d.C_CreateByNavigation)
                    .WithMany(p => p.TBDM_CodeMainC_CreateByNavigations)
                    .HasForeignKey(d => d.C_CreateBy)
                    .OnDelete(DeleteBehavior.ClientSetNull)
                    .HasConstraintName("FK_TBDM_CodeMain_C_CreateBy");

                entity.HasOne(d => d.C_LastUpdatedByNavigation)
                    .WithMany(p => p.TBDM_CodeMainC_LastUpdatedByNavigations)
                    .HasForeignKey(d => d.C_LastUpdatedBy)
                    .HasConstraintName("FK_TBDM_CodeMain_C_LastUpdatedBy");
            });

            modelBuilder.Entity<TBDM_Prov>(entity =>
            {
                entity.HasKey(e => e.C_Code)
                    .HasName("PRIMARY");

                entity.ToTable("TBDM_Prov");

                entity.Property(e => e.C_Code)
                    .HasColumnType("varchar(20)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_Name)
                    .IsRequired()
                    .HasColumnType("varchar(50)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_Status)
                    .IsRequired()
                    .HasColumnType("char(1)")
                    .HasDefaultValueSql("'1'")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.I_Sort).HasColumnType("int(11)");
            });

            modelBuilder.Entity<TDEV_DevAlert>(entity =>
            {
                entity.HasKey(e => e.C_ID)
                    .HasName("PRIMARY");

                entity.ToTable("TDEV_DevAlert");

                entity.Property(e => e.C_ID)
                    .ValueGeneratedNever()
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_ConfigCode)
                    .IsRequired()
                    .HasColumnType("varchar(50)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_DeviceCode)
                    .IsRequired()
                    .HasColumnType("varchar(50)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_Value)
                    .IsRequired()
                    .HasColumnType("varchar(100)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.D_CreateOn).HasColumnType("datetime");
            });

            modelBuilder.Entity<TDEV_DevAlertConfig>(entity =>
            {
                entity.HasKey(e => e.C_Code)
                    .HasName("PRIMARY");

                entity.ToTable("TDEV_DevAlertConfig");

                entity.HasIndex(e => e.C_CreateBy, "FK_TDEV_DevAlertConfig_C_CreateBy");

                entity.HasIndex(e => e.C_LastUpdatedBy, "FK_TDEV_DevAlertConfig_C_LastUpdatedBy");

                entity.Property(e => e.C_Code)
                    .HasColumnType("varchar(50)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_CreateBy)
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_LastUpdatedBy)
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_Name)
                    .IsRequired()
                    .HasColumnType("varchar(50)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_Remark)
                    .HasColumnType("varchar(1024)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_Status)
                    .IsRequired()
                    .HasColumnType("char(1)")
                    .HasDefaultValueSql("'1'")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.D_CreateOn).HasColumnType("datetime");

                entity.Property(e => e.D_LastUpdatedOn).HasColumnType("datetime");

                entity.HasOne(d => d.C_CreateByNavigation)
                    .WithMany(p => p.TDEV_DevAlertConfigC_CreateByNavigations)
                    .HasForeignKey(d => d.C_CreateBy)
                    .OnDelete(DeleteBehavior.ClientSetNull)
                    .HasConstraintName("FK_TDEV_DevAlertConfig_C_CreateBy");

                entity.HasOne(d => d.C_LastUpdatedByNavigation)
                    .WithMany(p => p.TDEV_DevAlertConfigC_LastUpdatedByNavigations)
                    .HasForeignKey(d => d.C_LastUpdatedBy)
                    .HasConstraintName("FK_TDEV_DevAlertConfig_C_LastUpdatedBy");
            });

            modelBuilder.Entity<TDEV_DevDataConfig>(entity =>
            {
                entity.HasKey(e => e.C_Code)
                    .HasName("PRIMARY");

                entity.ToTable("TDEV_DevDataConfig");

                entity.HasIndex(e => e.C_CreateBy, "FK_TDEV_DevDataConfig_C_CreateBy");

                entity.HasIndex(e => e.C_LastUpdatedBy, "FK_TDEV_DevDataConfig_C_LastUpdatedBy");

                entity.Property(e => e.C_Code)
                    .HasColumnType("varchar(50)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_CreateBy)
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_LastUpdatedBy)
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_Name)
                    .IsRequired()
                    .HasColumnType("varchar(50)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_Remark)
                    .HasColumnType("varchar(1024)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_Status)
                    .IsRequired()
                    .HasColumnType("char(1)")
                    .HasDefaultValueSql("'1'")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.D_CreateOn).HasColumnType("datetime");

                entity.Property(e => e.D_LastUpdatedOn).HasColumnType("datetime");

                entity.Property(e => e.I_Interval).HasColumnType("int(11)");

                entity.HasOne(d => d.C_CreateByNavigation)
                    .WithMany(p => p.TDEV_DevDataConfigC_CreateByNavigations)
                    .HasForeignKey(d => d.C_CreateBy)
                    .OnDelete(DeleteBehavior.ClientSetNull)
                    .HasConstraintName("FK_TDEV_DevDataConfig_C_CreateBy");

                entity.HasOne(d => d.C_LastUpdatedByNavigation)
                    .WithMany(p => p.TDEV_DevDataConfigC_LastUpdatedByNavigations)
                    .HasForeignKey(d => d.C_LastUpdatedBy)
                    .HasConstraintName("FK_TDEV_DevDataConfig_C_LastUpdatedBy");
            });

            modelBuilder.Entity<TDEV_DevData>(entity =>
            {
                entity.HasKey(e => e.C_ID)
                    .HasName("PRIMARY");

                entity.Property(e => e.C_ID)
                    .ValueGeneratedNever()
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_ConfigCode)
                    .IsRequired()
                    .HasColumnType("varchar(50)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_DeviceCode)
                    .IsRequired()
                    .HasColumnType("varchar(50)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_Value)
                    .IsRequired()
                    .HasColumnType("varchar(100)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.D_CreateOn).HasColumnType("datetime");
            });

            modelBuilder.Entity<TDEV_Device>(entity =>
            {
                entity.HasKey(e => e.C_Code)
                    .HasName("PRIMARY");

                entity.ToTable("TDEV_Device");

                entity.HasIndex(e => e.C_CreateBy, "FK_TDEV_Device_C_CreateBy");

                entity.HasIndex(e => e.C_LastUpdatedBy, "FK_TDEV_Device_C_LastUpdatedBy");

                //entity.HasIndex(e => e.C_ProductCode, "FK_TDEV_Device_C_ProductCode");

                entity.Property(e => e.C_Code)
                    .HasColumnType("varchar(50)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_CreateBy)
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_LastUpdatedBy)
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_MachineCode)
                    .HasColumnType("varchar(255)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_Name)
                    .IsRequired()
                    .HasColumnType("varchar(100)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                //entity.Property(e => e.C_ProductCode)
                //    .HasCharSet("utf8")
                //    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_Remark)
                    .HasColumnType("varchar(1024)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_Status)
                    .IsRequired()
                    .HasColumnType("char(1)")
                    .HasDefaultValueSql("'1'")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.D_CreateOn).HasColumnType("datetime");

                entity.Property(e => e.D_LastUpdatedOn).HasColumnType("datetime");

                entity.HasOne(d => d.C_CreateByNavigation)
                    .WithMany(p => p.TDEV_DeviceC_CreateByNavigations)
                    .HasForeignKey(d => d.C_CreateBy)
                    .OnDelete(DeleteBehavior.ClientSetNull)
                    .HasConstraintName("FK_TDEV_Device_C_CreateBy");

                entity.HasOne(d => d.C_LastUpdatedByNavigation)
                    .WithMany(p => p.TDEV_DeviceC_LastUpdatedByNavigations)
                    .HasForeignKey(d => d.C_LastUpdatedBy)
                    .HasConstraintName("FK_TDEV_Device_C_LastUpdatedBy");

                //entity.HasOne(d => d.C_ProductCodeNavigation)
                //    .WithMany(p => p.TDEV_Devices)
                //    .HasForeignKey(d => d.C_ProductCode)
                //    .OnDelete(DeleteBehavior.ClientSetNull)
                //    .HasConstraintName("FK_TDEV_Device_C_ProductCode");
            });

            modelBuilder.Entity<TISP_Content>(entity =>
            {
                entity.HasKey(e => e.C_ID)
                    .HasName("PRIMARY");

                entity.ToTable("TISP_Content");

                entity.HasIndex(e => e.C_CreateBy, "FK_TISP_Content_C_CreateBy");

                entity.HasIndex(e => e.C_LastUpdatedBy, "FK_TISP_Content_C_LastUpdatedBy");

                entity.HasIndex(e => e.C_StoreCode, "FK_TISP_Content_C_StoreCode");

                entity.Property(e => e.C_ID)
                    .ValueGeneratedNever()
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_AlarmLevel)
                    .IsRequired()
                    .HasColumnType("char(1)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_CreateBy)
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_LastUpdatedBy)
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_Name)
                    .IsRequired()
                    .HasColumnType("varchar(50)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_Remark)
                    .HasColumnType("varchar(500)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_Status)
                    .IsRequired()
                    .HasColumnType("char(1)")
                    .HasDefaultValueSql("'1'")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_StoreCode)
                    .IsRequired()
                    .HasColumnType("varchar(50)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.D_CreateOn).HasColumnType("datetime");

                entity.Property(e => e.D_LastUpdatedOn).HasColumnType("datetime");

                entity.Property(e => e.I_Sort).HasColumnType("int(11)");

                entity.HasOne(d => d.C_CreateByNavigation)
                    .WithMany(p => p.TISP_ContentC_CreateByNavigations)
                    .HasForeignKey(d => d.C_CreateBy)
                    .OnDelete(DeleteBehavior.ClientSetNull)
                    .HasConstraintName("FK_TISP_Content_C_CreateBy");

                entity.HasOne(d => d.C_LastUpdatedByNavigation)
                    .WithMany(p => p.TISP_ContentC_LastUpdatedByNavigations)
                    .HasForeignKey(d => d.C_LastUpdatedBy)
                    .HasConstraintName("FK_TISP_Content_C_LastUpdatedBy");

                entity.HasOne(d => d.C_StoreCodeNavigation)
                    .WithMany(p => p.TISP_Contents)
                    .HasPrincipalKey(p => p.C_Code)
                    .HasForeignKey(d => d.C_StoreCode)
                    .OnDelete(DeleteBehavior.ClientSetNull)
                    .HasConstraintName("FK_TISP_Content_C_StoreCode");
            });

            modelBuilder.Entity<TISP_ContentGroup>(entity =>
            {
                entity.HasKey(e => e.G_ID)
                    .HasName("PRIMARY");

                entity.ToTable("TISP_ContentGroup");

                entity.HasIndex(e => e.G_CreateBy, "FK_TISP_ContentGroup_C_CreateBy");

                entity.HasIndex(e => e.G_LastUpdatedBy, "FK_TISP_ContentGroup_C_LastUpdatedBy");

                entity.HasIndex(e => e.C_StoreCode, "FK_TISP_ContentGroup_C_StoreCode");

                entity.Property(e => e.G_ID)
                    .ValueGeneratedNever()
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_Name)
                    .IsRequired()
                    .HasColumnType("varchar(50)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_PatrolItem)
                    .HasColumnType("varchar(50)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_Remark)
                    .HasColumnType("varchar(500)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_Status)
                    .IsRequired()
                    .HasColumnType("char(1)")
                    .HasDefaultValueSql("'1'")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_StoreCode)
                    .IsRequired()
                    .HasColumnType("varchar(50)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.D_CreateOn).HasColumnType("datetime");

                entity.Property(e => e.D_LastUpdatedOn).HasColumnType("datetime");

                entity.Property(e => e.G_CreateBy)
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.G_LastUpdatedBy)
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.I_Sort).HasColumnType("int(11)");

                entity.Property(e => e.I_Type).HasColumnType("int(11)");

                entity.HasOne(d => d.C_StoreCodeNavigation)
                    .WithMany(p => p.TISP_ContentGroups)
                    .HasPrincipalKey(p => p.C_Code)
                    .HasForeignKey(d => d.C_StoreCode)
                    .OnDelete(DeleteBehavior.ClientSetNull) 
                    .HasConstraintName("FK_TISP_ContentGroup_C_StoreCode");

                entity.HasOne(d => d.G_CreateByNavigation)
                    .WithMany(p => p.TISP_ContentGroupG_CreateByNavigations)
                    .HasForeignKey(d => d.G_CreateBy)
                    .OnDelete(DeleteBehavior.ClientSetNull)
                    .HasConstraintName("FK_TISP_ContentGroup_C_CreateBy");

                entity.HasOne(d => d.G_LastUpdatedByNavigation)
                    .WithMany(p => p.TISP_ContentGroupG_LastUpdatedByNavigations)
                    .HasForeignKey(d => d.G_LastUpdatedBy)
                    .HasConstraintName("FK_TISP_ContentGroup_C_LastUpdatedBy");
            });

            modelBuilder.Entity<TISP_ContentGroupItem>(entity =>
            {
                entity.HasKey(e => e.G_ID)
                    .HasName("PRIMARY");

                entity.ToTable("TISP_ContentGroupItem");

                entity.HasIndex(e => e.G_ContentCode, "FK_TISP_ContentGroupItem_G_ContentCode");

                entity.HasIndex(e => e.G_ContentGroupCode, "FK_TISP_ContentGroupItem_G_ContentGroupCode");

                entity.Property(e => e.G_ID)
                    .ValueGeneratedNever()
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.G_ContentCode)
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.G_ContentGroupCode)
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.HasOne(d => d.G_ContentCodeNavigation)
                    .WithMany(p => p.TISP_ContentGroupItems)
                    .HasForeignKey(d => d.G_ContentCode)
                    .OnDelete(DeleteBehavior.ClientSetNull)
                    .HasConstraintName("FK_TISP_ContentGroupItem_G_ContentCode");

                entity.HasOne(d => d.G_ContentGroupCodeNavigation)
                    .WithMany(p => p.TISP_ContentGroupItems)
                    .HasForeignKey(d => d.G_ContentGroupCode)
                    .OnDelete(DeleteBehavior.ClientSetNull)
                    .HasConstraintName("FK_TISP_ContentGroupItem_G_ContentGroupCode");
            });

            modelBuilder.Entity<TISP_Record>(entity =>
            {
                entity.HasKey(e => e.C_ID)
                    .HasName("PRIMARY");

                entity.ToTable("TISP_Record");

                entity.HasIndex(e => e.C_CreateBy, "FK_TISP_Record_C_CreateBy");

                entity.HasIndex(e => e.C_LastUpdatedBy, "FK_TISP_Record_C_LastUpdatedBy");

                entity.HasIndex(e => e.C_SpotCode, "FK_TISP_Record_C_SpotCode");

                entity.Property(e => e.C_ID)
                    .ValueGeneratedNever()
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_CreateBy)
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_LastUpdatedBy)
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_SpotCode)
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_Status)
                    .IsRequired()
                    .HasColumnType("char(1)")
                    .HasDefaultValueSql("'1'")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.D_CreateOn).HasColumnType("datetime");

                entity.Property(e => e.D_LastUpdatedOn).HasColumnType("datetime");

                entity.HasOne(d => d.C_CreateByNavigation)
                    .WithMany(p => p.TISP_RecordC_CreateByNavigations)
                    .HasForeignKey(d => d.C_CreateBy)
                    .OnDelete(DeleteBehavior.ClientSetNull)
                    .HasConstraintName("FK_TISP_Record_C_CreateBy");

                entity.HasOne(d => d.C_LastUpdatedByNavigation)
                    .WithMany(p => p.TISP_RecordC_LastUpdatedByNavigations)
                    .HasForeignKey(d => d.C_LastUpdatedBy)
                    .HasConstraintName("FK_TISP_Record_C_LastUpdatedBy");

                entity.HasOne(d => d.C_SpotCodeNavigation)
                    .WithMany(p => p.TISP_Records)
                    .HasForeignKey(d => d.C_SpotCode)
                    .OnDelete(DeleteBehavior.ClientSetNull)
                    .HasConstraintName("FK_TISP_Record_C_SpotCode");
            });

            modelBuilder.Entity<TISP_RecordImage>(entity =>
            {
                entity.HasKey(e => e.C_ID)
                    .HasName("PRIMARY");

                entity.ToTable("TISP_RecordImage");

                entity.HasIndex(e => e.C_RecordItemCode, "FK_TISP_RecordImage_C_RecordItemCode");

                entity.Property(e => e.C_ID)
                    .ValueGeneratedNever()
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_ImageUrl)
                    .IsRequired()
                    .HasColumnType("varchar(200)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_RecordItemCode)
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_Status)
                    .IsRequired()
                    .HasColumnType("char(1)")
                    .HasDefaultValueSql("'1'")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.HasOne(d => d.C_RecordItemCodeNavigation)
                    .WithMany(p => p.TISP_RecordImages)
                    .HasForeignKey(d => d.C_RecordItemCode)
                    .OnDelete(DeleteBehavior.ClientSetNull)
                    .HasConstraintName("FK_TISP_RecordImage_C_RecordItemCode");
            });

            modelBuilder.Entity<TISP_RecordItem>(entity =>
            {
                entity.HasKey(e => e.C_ID)
                    .HasName("PRIMARY");

                entity.ToTable("TISP_RecordItem");

                entity.HasIndex(e => e.C_ContentCode, "FK_TISP_RecordItem_C_ContentCode");

                entity.HasIndex(e => e.C_CreateBy, "FK_TISP_RecordItem_C_CreateBy");

                entity.HasIndex(e => e.C_LastUpdatedBy, "FK_TISP_RecordItem_C_LastUpdatedBy");

                entity.HasIndex(e => e.C_RecordCode, "FK_TISP_RecordItem_C_RecordCode");

                entity.Property(e => e.C_ID)
                    .ValueGeneratedNever()
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_ContentCode)
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_CreateBy)
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_InspectionContent)
                    .IsRequired()
                    .HasColumnType("varchar(500)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_LastUpdatedBy)
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_RecordCode)
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_Remark)
                    .HasColumnType("varchar(500)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_Status)
                    .IsRequired()
                    .HasColumnType("char(1)")
                    .HasDefaultValueSql("'1'")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.D_CreateOn).HasColumnType("datetime");

                entity.Property(e => e.D_LastUpdatedOn).HasColumnType("datetime");

                entity.HasOne(d => d.C_ContentCodeNavigation)
                    .WithMany(p => p.TISP_RecordItems)
                    .HasForeignKey(d => d.C_ContentCode)
                    .OnDelete(DeleteBehavior.ClientSetNull)
                    .HasConstraintName("FK_TISP_RecordItem_C_ContentCode");

                entity.HasOne(d => d.C_CreateByNavigation)
                    .WithMany(p => p.TISP_RecordItemC_CreateByNavigations)
                    .HasForeignKey(d => d.C_CreateBy)
                    .OnDelete(DeleteBehavior.ClientSetNull)
                    .HasConstraintName("FK_TISP_RecordItem_C_CreateBy");

                entity.HasOne(d => d.C_LastUpdatedByNavigation)
                    .WithMany(p => p.TISP_RecordItemC_LastUpdatedByNavigations)
                    .HasForeignKey(d => d.C_LastUpdatedBy)
                    .HasConstraintName("FK_TISP_RecordItem_C_LastUpdatedBy");

                entity.HasOne(d => d.C_RecordCodeNavigation)
                    .WithMany(p => p.TISP_RecordItems)
                    .HasForeignKey(d => d.C_RecordCode)
                    .OnDelete(DeleteBehavior.ClientSetNull)
                    .HasConstraintName("FK_TISP_RecordItem_C_RecordCode");
            });

            modelBuilder.Entity<TISP_Report>(entity =>
            {
                entity.HasKey(e => e.G_ID)
                    .HasName("PRIMARY");

                entity.ToTable("TISP_Report");

                entity.HasIndex(e => e.C_StoreCode, "FK_TISP_Report_C_StoreCode");

                entity.Property(e => e.G_ID)
                    .ValueGeneratedNever()
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_Data)
                    .HasColumnType("longtext")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_GroupName)
                    .HasColumnType("varchar(50)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_Name)
                    .IsRequired()
                    .HasColumnType("varchar(50)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_Remark)
                    .HasColumnType("varchar(500)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_Status)
                    .IsRequired()
                    .HasColumnType("char(1)")
                    .HasDefaultValueSql("'1'")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_StoreCode)
                    .IsRequired()
                    .HasColumnType("varchar(50)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.D_CreateTime).HasColumnType("datetime");

                entity.Property(e => e.D_End).HasColumnType("datetime");

                entity.Property(e => e.D_Start).HasColumnType("datetime");

                entity.Property(e => e.I_Type).HasColumnType("int(11)");

                entity.HasOne(d => d.C_StoreCodeNavigation)
                    .WithMany(p => p.TISP_Reports)
                    .HasPrincipalKey(p => p.C_Code)
                    .HasForeignKey(d => d.C_StoreCode)
                    .OnDelete(DeleteBehavior.ClientSetNull)
                    .HasConstraintName("FK_TISP_Report_C_StoreCode");
            });

            modelBuilder.Entity<TISP_SecurityImage>(entity =>
            {
                entity.HasKey(e => e.C_ID)
                    .HasName("PRIMARY");

                entity.ToTable("TISP_SecurityImage");

                entity.HasIndex(e => e.C_SecurityRecordCode, "FK_TISP_SecurityImage_C_SecurityRecordCode");

                entity.Property(e => e.C_ID)
                    .ValueGeneratedNever()
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_ImageUrl)
                    .IsRequired()
                    .HasColumnType("varchar(200)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_SecurityRecordCode)
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_Status)
                    .IsRequired()
                    .HasColumnType("char(1)")
                    .HasDefaultValueSql("'1'")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.HasOne(d => d.C_SecurityRecordCodeNavigation)
                    .WithMany(p => p.TISP_SecurityImages)
                    .HasForeignKey(d => d.C_SecurityRecordCode)
                    .OnDelete(DeleteBehavior.ClientSetNull)
                    .HasConstraintName("FK_TISP_SecurityImage_C_SecurityRecordCode");
            });

            modelBuilder.Entity<TISP_SecurityItem>(entity =>
            {
                entity.HasKey(e => e.C_ID)
                    .HasName("PRIMARY");

                entity.ToTable("TISP_SecurityItem");

                entity.HasIndex(e => e.C_CreateBy, "FK_TISP_SecurityItem_C_CreateBy");

                entity.HasIndex(e => e.C_LastUpdatedBy, "FK_TISP_SecurityItem_C_LastUpdatedBy");

                entity.HasIndex(e => e.C_RecordItemCode, "FK_TISP_SecurityItem_C_RecordItemCode");

                entity.Property(e => e.C_ID)
                    .ValueGeneratedNever()
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_CreateBy)
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_LastUpdatedBy)
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_RecordItemCode)
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_Remark)
                    .HasColumnType("varchar(500)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_SecurityContent)
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_Status)
                    .IsRequired()
                    .HasColumnType("char(1)")
                    .HasDefaultValueSql("'1'")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.D_CreateOn).HasColumnType("datetime");

                entity.Property(e => e.D_LastUpdatedOn).HasColumnType("datetime");

                entity.HasOne(d => d.C_CreateByNavigation)
                    .WithMany(p => p.TISP_SecurityItemC_CreateByNavigations)
                    .HasForeignKey(d => d.C_CreateBy)
                    .OnDelete(DeleteBehavior.ClientSetNull)
                    .HasConstraintName("FK_TISP_SecurityItem_C_CreateBy");

                entity.HasOne(d => d.C_LastUpdatedByNavigation)
                    .WithMany(p => p.TISP_SecurityItemC_LastUpdatedByNavigations)
                    .HasForeignKey(d => d.C_LastUpdatedBy)
                    .HasConstraintName("FK_TISP_SecurityItem_C_LastUpdatedBy");

                entity.HasOne(d => d.C_RecordItemCodeNavigation)
                    .WithMany(p => p.TISP_SecurityItems)
                    .HasForeignKey(d => d.C_RecordItemCode)
                    .OnDelete(DeleteBehavior.ClientSetNull)
                    .HasConstraintName("FK_TISP_SecurityItem_C_RecordItemCode");
            });

            modelBuilder.Entity<TISP_Spot>(entity =>
            {
                entity.HasKey(e => e.C_Code)
                    .HasName("PRIMARY");

                entity.ToTable("TISP_Spot");

                entity.HasIndex(e => e.C_QRCode, "AK_Key")
                    .IsUnique();

                entity.HasIndex(e => e.C_AreaCode, "FK_TISP_Spot_C_AreaCode");

                entity.HasIndex(e => e.C_CreateBy, "FK_TISP_Spot_C_CreateBy");

                entity.HasIndex(e => e.C_LastUpdatedBy, "FK_TISP_Spot_C_LastUpdatedBy");

                entity.HasIndex(e => e.C_StoreCode, "FK_TISP_Spot_C_StoreCode");

                entity.Property(e => e.C_Code)
                    .ValueGeneratedNever()
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_AreaCode)
                    .HasColumnType("varchar(50)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_CreateBy)
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_GPS)
                    .HasColumnType("varchar(100)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_ImageUrl)
                    .HasColumnType("varchar(255)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_LastUpdatedBy)
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_Name)
                    .IsRequired()
                    .HasColumnType("varchar(50)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_Number)
                    .IsRequired()
                    .HasColumnType("varchar(50)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_Position)
                    .HasColumnType("varchar(100)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_QRCode)
                    .HasColumnType("varchar(100)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_Remark)
                    .HasColumnType("varchar(1024)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_Status)
                    .IsRequired()
                    .HasColumnType("char(1)")
                    .HasDefaultValueSql("'1'")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_StoreCode)
                    .IsRequired()
                    .HasColumnType("varchar(50)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.D_CreateOn).HasColumnType("datetime");

                entity.Property(e => e.D_LastUpdatedOn).HasColumnType("datetime");

                entity.Property(e => e.F_Map_X).HasPrecision(12, 2);

                entity.Property(e => e.F_Map_Y).HasPrecision(12, 2);

                entity.Property(e => e.I_Offset).HasColumnType("int(11)");

                entity.HasOne(d => d.C_AreaCodeNavigation)
                    .WithMany(p => p.TISP_Spots)
                    .HasForeignKey(d => d.C_AreaCode)
                    .HasConstraintName("FK_TISP_Spot_C_AreaCode");

                entity.HasOne(d => d.C_CreateByNavigation)
                    .WithMany(p => p.TISP_SpotC_CreateByNavigations)
                    .HasForeignKey(d => d.C_CreateBy)
                    .OnDelete(DeleteBehavior.ClientSetNull)
                    .HasConstraintName("FK_TISP_Spot_C_CreateBy");

                entity.HasOne(d => d.C_LastUpdatedByNavigation)
                    .WithMany(p => p.TISP_SpotC_LastUpdatedByNavigations)
                    .HasForeignKey(d => d.C_LastUpdatedBy)
                    .HasConstraintName("FK_TISP_Spot_C_LastUpdatedBy");

                entity.HasOne(d => d.C_StoreCodeNavigation)
                    .WithMany(p => p.TISP_Spots)
                    .HasPrincipalKey(p => p.C_Code)
                    .HasForeignKey(d => d.C_StoreCode)
                    .OnDelete(DeleteBehavior.ClientSetNull)
                    .HasConstraintName("FK_TISP_Spot_C_StoreCode");
            });

            modelBuilder.Entity<TISP_SpotContent>(entity =>
            {
                entity.HasKey(e => e.C_ID)
                    .HasName("PRIMARY");

                entity.ToTable("TISP_SpotContent");

                entity.HasIndex(e => new { e.C_SpotCode, e.C_ContentCode }, "AK_Key")
                    .IsUnique();

                entity.HasIndex(e => e.C_ContentCode, "FK_TISP_SpotContent_C_ContentCode");

                entity.HasIndex(e => e.C_CreateBy, "FK_TISP_SpotContent_C_CreateBy");

                entity.Property(e => e.C_ID)
                    .ValueGeneratedNever()
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_ContentCode)
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_CreateBy)
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_Remark)
                    .HasColumnType("varchar(500)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_SpotCode)
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.D_CreateOn).HasColumnType("datetime");

                entity.HasOne(d => d.C_ContentCodeNavigation)
                    .WithMany(p => p.TISP_SpotContents)
                    .HasForeignKey(d => d.C_ContentCode)
                    .OnDelete(DeleteBehavior.ClientSetNull)
                    .HasConstraintName("FK_TISP_SpotContent_C_ContentCode");

                entity.HasOne(d => d.C_CreateByNavigation)
                    .WithMany(p => p.TISP_SpotContents)
                    .HasForeignKey(d => d.C_CreateBy)
                    .OnDelete(DeleteBehavior.ClientSetNull)
                    .HasConstraintName("FK_TISP_SpotContent_C_CreateBy");

                entity.HasOne(d => d.C_SpotCodeNavigation)
                    .WithMany(p => p.TISP_SpotContents)
                    .HasForeignKey(d => d.C_SpotCode)
                    .OnDelete(DeleteBehavior.ClientSetNull)
                    .HasConstraintName("FK_TISP_SpotContent_C_SpotCode");
            });

            modelBuilder.Entity<TISP_SpotUser>(entity =>
            {
                entity.HasKey(e => e.C_ID)
                    .HasName("PRIMARY");

                entity.ToTable("TISP_SpotUser");

                entity.HasIndex(e => new { e.C_UserCode, e.C_SpotCode }, "AK_Key")
                    .IsUnique();

                entity.HasIndex(e => e.C_CreateBy, "FK_TISP_SpotUser_C_CreateBy");

                entity.HasIndex(e => e.C_SpotCode, "FK_TISP_SpotUser_C_SpotCode");

                entity.Property(e => e.C_ID)
                    .ValueGeneratedNever()
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_CreateBy)
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_Remark)
                    .HasColumnType("varchar(500)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_SpotCode)
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_UserCode)
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.D_CreateOn).HasColumnType("datetime");

                entity.HasOne(d => d.C_CreateByNavigation)
                    .WithMany(p => p.TISP_SpotUserC_CreateByNavigations)
                    .HasForeignKey(d => d.C_CreateBy)
                    .OnDelete(DeleteBehavior.ClientSetNull)
                    .HasConstraintName("FK_TISP_SpotUser_C_CreateBy");

                entity.HasOne(d => d.C_SpotCodeNavigation)
                    .WithMany(p => p.TISP_SpotUsers)
                    .HasForeignKey(d => d.C_SpotCode)
                    .OnDelete(DeleteBehavior.ClientSetNull)
                    .HasConstraintName("FK_TISP_SpotUser_C_SpotCode");

                entity.HasOne(d => d.C_UserCodeNavigation)
                    .WithMany(p => p.TISP_SpotUserC_UserCodeNavigations)
                    .HasForeignKey(d => d.C_UserCode)
                    .OnDelete(DeleteBehavior.ClientSetNull)
                    .HasConstraintName("FK_TISP_SpotUser_C_UserCode");
            });

            modelBuilder.Entity<TPNT_Area>(entity =>
            {
                entity.HasKey(e => e.C_Code)
                    .HasName("PRIMARY");

                entity.ToTable("TPNT_Area");

                entity.HasIndex(e => e.C_CreateBy, "FK_TPNT_Area_C_CreateBy");

                entity.HasIndex(e => e.C_LastUpdatedBy, "FK_TPNT_Area_C_LastUpdatedBy");

                entity.HasIndex(e => e.C_StoreCode, "FK_TPNT_Area_C_StoreCode");

                entity.Property(e => e.C_Code)
                    .HasColumnType("varchar(50)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_CreateBy)
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_ImageUrl)
                    .HasColumnType("varchar(255)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_LastUpdatedBy)
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_Name)
                    .IsRequired()
                    .HasColumnType("varchar(255)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_Remark)
                    .HasColumnType("varchar(1024)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_SName)
                    .HasColumnType("varchar(16)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_Status)
                    .IsRequired()
                    .HasColumnType("char(1)")
                    .HasDefaultValueSql("'1'")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_StoreCode)
                    .IsRequired()
                    .HasColumnType("varchar(50)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.D_CreateOn).HasColumnType("datetime");

                entity.Property(e => e.D_LastUpdatedOn).HasColumnType("datetime");

                entity.Property(e => e.I_Sort).HasColumnType("int(11)");

                entity.HasOne(d => d.C_CreateByNavigation)
                    .WithMany(p => p.TPNT_AreaC_CreateByNavigations)
                    .HasForeignKey(d => d.C_CreateBy)
                    .OnDelete(DeleteBehavior.ClientSetNull)
                    .HasConstraintName("FK_TPNT_Area_C_CreateBy");

                entity.HasOne(d => d.C_LastUpdatedByNavigation)
                    .WithMany(p => p.TPNT_AreaC_LastUpdatedByNavigations)
                    .HasForeignKey(d => d.C_LastUpdatedBy)
                    .HasConstraintName("FK_TPNT_Area_C_LastUpdatedBy");

                entity.HasOne(d => d.C_StoreCodeNavigation)
                    .WithMany(p => p.TPNT_Areas)
                    .HasPrincipalKey(p => p.C_Code)
                    .HasForeignKey(d => d.C_StoreCode)
                    .OnDelete(DeleteBehavior.ClientSetNull)
                    .HasConstraintName("FK_TPNT_Area_C_StoreCode");
            });

            modelBuilder.Entity<TPNT_Store>(entity =>
            {
                entity.HasKey(e => e.C_ID)
                    .HasName("PRIMARY");

                entity.ToTable("TPNT_Store");

                entity.HasIndex(e => e.C_Code, "AK_Key")
                    .IsUnique();

                entity.HasIndex(e => e.C_AreaCode, "FK_TPNT_Store_C_AreaCode");

                entity.HasIndex(e => e.C_CreateBy, "FK_TPNT_Store_C_CreateBy");

                entity.HasIndex(e => e.C_LastUpdatedBy, "FK_TPNT_Store_C_LastUpdatedBy");

                entity.HasIndex(e => e.C_LicenseCode, "FK_TPNT_Store_C_LicenseCode");

                entity.HasIndex(e => e.C_TypeCode, "FK_TPNT_Store_C_TypeCode");

                entity.Property(e => e.C_ID)
                    .ValueGeneratedNever()
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_Address)
                    .HasColumnType("varchar(500)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_AreaCode)
                    .HasColumnType("varchar(20)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_Code)
                    .IsRequired()
                    .HasColumnType("varchar(50)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_CreateBy)
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_GPS)
                    .HasColumnType("varchar(500)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_LastUpdatedBy)
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_LicenseCode)
                    .IsRequired()
                    .HasColumnType("varchar(50)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_Name)
                    .IsRequired()
                    .HasColumnType("varchar(255)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_Remark)
                    .HasColumnType("varchar(1024)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_SName)
                    .IsRequired()
                    .HasColumnType("varchar(16)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_Status)
                    .IsRequired()
                    .HasColumnType("char(1)")
                    .HasDefaultValueSql("'1'")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_TypeCode)
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.D_CreateOn).HasColumnType("datetime");

                entity.Property(e => e.D_LastUpdatedOn).HasColumnType("datetime");

                entity.Property(e => e.I_Sort).HasColumnType("int(11)");

                entity.HasOne(d => d.C_AreaCodeNavigation)
                    .WithMany(p => p.TPNT_Stores)
                    .HasForeignKey(d => d.C_AreaCode)
                    .HasConstraintName("FK_TPNT_Store_C_AreaCode");

                entity.HasOne(d => d.C_CreateByNavigation)
                    .WithMany(p => p.TPNT_StoreC_CreateByNavigations)
                    .HasForeignKey(d => d.C_CreateBy)
                    .OnDelete(DeleteBehavior.ClientSetNull)
                    .HasConstraintName("FK_TPNT_Store_C_CreateBy");

                entity.HasOne(d => d.C_LastUpdatedByNavigation)
                    .WithMany(p => p.TPNT_StoreC_LastUpdatedByNavigations)
                    .HasForeignKey(d => d.C_LastUpdatedBy)
                    .HasConstraintName("FK_TPNT_Store_C_LastUpdatedBy");

                entity.HasOne(d => d.C_LicenseCodeNavigation)
                    .WithMany(p => p.TPNT_Stores)
                    .HasPrincipalKey(p => p.C_Code)
                    .HasForeignKey(d => d.C_LicenseCode)
                    .OnDelete(DeleteBehavior.ClientSetNull)
                    .HasConstraintName("FK_TPNT_Store_C_LicenseCode");

                entity.HasOne(d => d.C_TypeCodeNavigation)
                    .WithMany(p => p.TPNT_Stores)
                    .HasForeignKey(d => d.C_TypeCode)
                    .OnDelete(DeleteBehavior.ClientSetNull)
                    .HasConstraintName("FK_TPNT_Store_C_TypeCode");
            });

            modelBuilder.Entity<TPNT_StoreOrg>(entity =>
            {
                entity.HasKey(e => new { e.C_StoreCode, e.C_OrgCode })
                    .HasName("PRIMARY")
                    .HasAnnotation("MySql:IndexPrefixLength", new[] { 0, 0 });

                entity.ToTable("TPNT_StoreOrg");

                entity.HasIndex(e => e.C_CreateBy, "FK_TPNT_StoreOrg_C_CreateBy");

                entity.HasIndex(e => e.C_OrgCode, "FK_TPNT_StoreOrg_C_OrgCode");

                entity.Property(e => e.C_StoreCode)
                    .HasColumnType("varchar(50)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_OrgCode)
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_CreateBy)
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.D_CreateOn).HasColumnType("datetime");

                entity.HasOne(d => d.C_CreateByNavigation)
                    .WithMany(p => p.TPNT_StoreOrgs)
                    .HasForeignKey(d => d.C_CreateBy)
                    .OnDelete(DeleteBehavior.ClientSetNull)
                    .HasConstraintName("FK_TPNT_StoreOrg_C_CreateBy");

                entity.HasOne(d => d.C_OrgCodeNavigation)
                    .WithMany(p => p.TPNT_StoreOrgs)
                    .HasPrincipalKey(p => p.C_Code)
                    .HasForeignKey(d => d.C_OrgCode)
                    .OnDelete(DeleteBehavior.ClientSetNull)
                    .HasConstraintName("FK_TPNT_StoreOrg_C_OrgCode");

                entity.HasOne(d => d.C_StoreCodeNavigation)
                    .WithMany(p => p.TPNT_StoreOrgs)
                    .HasPrincipalKey(p => p.C_Code)
                    .HasForeignKey(d => d.C_StoreCode)
                    .OnDelete(DeleteBehavior.ClientSetNull)
                    .HasConstraintName("FK_TPNT_StoreOrg_C_StoreCode");
            });

            modelBuilder.Entity<TPNT_Type>(entity =>
            {
                entity.HasKey(e => e.C_Code)
                    .HasName("PRIMARY");

                entity.ToTable("TPNT_Type");

                entity.Property(e => e.C_Code)
                    .ValueGeneratedNever()
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_Name)
                    .IsRequired()
                    .HasColumnType("varchar(50)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_Status)
                    .IsRequired()
                    .HasColumnType("char(1)")
                    .HasDefaultValueSql("'1'")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.I_Sort).HasColumnType("int(11)");
            });

            modelBuilder.Entity<TPRD_Log>(entity =>
            {
                entity.HasKey(e => e.C_Code)
                    .HasName("PRIMARY");

                entity.ToTable("TPRD_Log");

                entity.HasIndex(e => e.C_CreateBy, "FK_TPRD_Log_C_CreateBy");

                entity.HasIndex(e => e.C_ProductCode, "FK_TPRD_Log_C_ProductCode");

                entity.HasIndex(e => e.C_StoreCode, "FK_TPRD_Log_C_StoreCode");

                entity.Property(e => e.C_Code)
                    .ValueGeneratedNever()
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_AlarmMsg)
                    .HasColumnType("varchar(1024)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_CreateBy)
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_DeviceCode)
                    .HasColumnType("varchar(50)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_ProductCode)
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_Remark)
                    .HasColumnType("varchar(1024)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_SpotCode)
                    .HasColumnType("varchar(50)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_StoreCode)
                    .IsRequired()
                    .HasColumnType("varchar(50)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.D_CreateOn).HasColumnType("datetime");

                entity.Property(e => e.I_Type).HasColumnType("int(11)");

                entity.HasOne(d => d.C_CreateByNavigation)
                    .WithMany(p => p.TPRD_Logs)
                    .HasForeignKey(d => d.C_CreateBy)
                    .OnDelete(DeleteBehavior.ClientSetNull)
                    .HasConstraintName("FK_TPRD_Log_C_CreateBy");

                entity.HasOne(d => d.C_ProductCodeNavigation)
                    .WithMany(p => p.TPRD_Logs)
                    .HasForeignKey(d => d.C_ProductCode)
                    .OnDelete(DeleteBehavior.ClientSetNull)
                    .HasConstraintName("FK_TPRD_Log_C_ProductCode");

                entity.HasOne(d => d.C_StoreCodeNavigation)
                    .WithMany(p => p.TPRD_Logs)
                    .HasPrincipalKey(p => p.C_Code)
                    .HasForeignKey(d => d.C_StoreCode)
                    .OnDelete(DeleteBehavior.ClientSetNull)
                    .HasConstraintName("FK_TPRD_Log_C_StoreCode");
            });

            modelBuilder.Entity<TPRD_ProdSKU>(entity =>
            {
                entity.HasKey(e => e.C_SKUCode)
                    .HasName("PRIMARY");

                entity.ToTable("TPRD_ProdSKU");

                entity.HasIndex(e => e.C_CreateBy, "FK_TPRD_ProdSKU_C_CreateBy");

                entity.HasIndex(e => e.C_LastUpdatedBy, "FK_TPRD_ProdSKU_C_LastUpdatedBy");

                entity.HasIndex(e => e.C_TypeCode, "FK_TPRD_ProdSKU_C_TypeCode");

                entity.Property(e => e.C_SKUCode)
                    .HasColumnType("varchar(100)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_Brand)
                    .HasColumnType("varchar(100)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_CreateBy)
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_IconPath)
                    .HasColumnType("varchar(500)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_ImagePath)
                    .HasColumnType("varchar(500)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_LastUpdatedBy)
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_Name)
                    .IsRequired()
                    .HasColumnType("varchar(255)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_ProdArea)
                    .HasColumnType("varchar(50)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_Remark)
                    .HasColumnType("varchar(1024)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_Spec)
                    .HasColumnType("varchar(500)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_Status)
                    .IsRequired()
                    .HasColumnType("char(1)")
                    .HasDefaultValueSql("'1'")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_TypeCode)
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_Unit)
                    .HasColumnType("varchar(50)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_Vender)
                    .HasColumnType("varchar(255)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.D_CreateOn).HasColumnType("datetime");

                entity.Property(e => e.D_LastUpdatedOn).HasColumnType("datetime");

                entity.Property(e => e.I_AlarmDays).HasColumnType("int(11)");

                entity.Property(e => e.I_MinStock).HasColumnType("int(11)");

                entity.Property(e => e.I_Sort).HasColumnType("int(11)");

                entity.Property(e => e.I_ValiDays).HasColumnType("int(11)");

                entity.HasOne(d => d.C_CreateByNavigation)
                    .WithMany(p => p.TPRD_ProdSKUC_CreateByNavigations)
                    .HasForeignKey(d => d.C_CreateBy)
                    .OnDelete(DeleteBehavior.ClientSetNull)
                    .HasConstraintName("FK_TPRD_ProdSKU_C_CreateBy");

                entity.HasOne(d => d.C_LastUpdatedByNavigation)
                    .WithMany(p => p.TPRD_ProdSKUC_LastUpdatedByNavigations)
                    .HasForeignKey(d => d.C_LastUpdatedBy)
                    .HasConstraintName("FK_TPRD_ProdSKU_C_LastUpdatedBy");

                entity.HasOne(d => d.C_TypeCodeNavigation)
                    .WithMany(p => p.TPRD_ProdSKUs)
                    .HasForeignKey(d => d.C_TypeCode)
                    .HasConstraintName("FK_TPRD_ProdSKU_C_TypeCode");
            });

            modelBuilder.Entity<TPRD_Product>(entity =>
            {
                entity.HasKey(e => e.C_Code)
                    .HasName("PRIMARY");

                entity.ToTable("TPRD_Product");

                entity.HasIndex(e => e.C_QRCode, "AK_Key")
                    .IsUnique();

                entity.HasIndex(e => new { e.C_SKUCode, e.C_Code }, "C_SKUCode");

                entity.HasIndex(e => e.C_AreaCode, "FK_TPRD_Product_C_AreaCode");

                entity.HasIndex(e => e.C_CreateBy, "FK_TPRD_Product_C_CreateBy");

                entity.HasIndex(e => e.C_DeviceCode, "FK_TPRD_Product_C_DeviceCode");

                entity.HasIndex(e => e.C_LastUpdatedBy, "FK_TPRD_Product_C_LastUpdatedBy");

                entity.HasIndex(e => e.C_SpotCode, "FK_TPRD_Product_C_SpotCode");

                entity.HasIndex(e => e.C_StoreCode, "FK_TPRD_Product_C_StoreCode");

                entity.Property(e => e.C_Code)
                    .ValueGeneratedNever()
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_AlarmMsg)
                    .HasColumnType("varchar(1024)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_AreaCode)
                    .HasColumnType("varchar(50)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_CreateBy)
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_DeviceCode)
                    .HasColumnType("varchar(50)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_ImageUrl)
                    .HasColumnType("varchar(255)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_LastUpdatedBy)
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_QRCode)
                    .IsRequired()
                    .HasColumnType("varchar(255)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_Remark)
                    .HasColumnType("varchar(1024)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_SKUCode)
                    .IsRequired()
                    .HasColumnType("varchar(100)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_SpotCode)
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_StoreCode)
                    .IsRequired()
                    .HasColumnType("varchar(50)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.D_CreateOn).HasColumnType("datetime");

                entity.Property(e => e.D_LastISP).HasColumnType("datetime");

                entity.Property(e => e.D_LastUpdatedOn).HasColumnType("datetime");

                entity.Property(e => e.D_ProdDate).HasColumnType("date");

                entity.Property(e => e.D_ValiDate).HasColumnType("date");

                entity.Property(e => e.F_Map_X).HasPrecision(12, 2);

                entity.Property(e => e.F_Map_Y).HasPrecision(12, 2);

                entity.Property(e => e.I_IsAlarm)
                    .HasColumnType("int(11)")
                    .HasDefaultValueSql("'0'");

                entity.Property(e => e.I_Sort).HasColumnType("int(11)");

                entity.Property(e => e.I_Status).HasColumnType("int(11)");

                entity.HasOne(d => d.C_AreaCodeNavigation)
                    .WithMany(p => p.TPRD_Products)
                    .HasForeignKey(d => d.C_AreaCode)
                    .HasConstraintName("FK_TPRD_Product_C_AreaCode");

                entity.HasOne(d => d.C_CreateByNavigation)
                    .WithMany(p => p.TPRD_ProductC_CreateByNavigations)
                    .HasForeignKey(d => d.C_CreateBy)
                    .OnDelete(DeleteBehavior.ClientSetNull)
                    .HasConstraintName("FK_TPRD_Product_C_CreateBy");

                //entity.HasOne(d => d.C_DeviceCodeNavigation)
                //    .WithMany(p => p.TPRD_Products)
                //    .HasForeignKey(d => d.C_DeviceCode)
                //    .HasConstraintName("FK_TPRD_Product_C_DeviceCode");

                entity.HasOne(d => d.C_LastUpdatedByNavigation)
                    .WithMany(p => p.TPRD_ProductC_LastUpdatedByNavigations)
                    .HasForeignKey(d => d.C_LastUpdatedBy)
                    .HasConstraintName("FK_TPRD_Product_C_LastUpdatedBy");

                entity.HasOne(d => d.C_SKUCodeNavigation)
                    .WithMany(p => p.TPRD_Products)
                    .HasForeignKey(d => d.C_SKUCode)
                    .OnDelete(DeleteBehavior.ClientSetNull)
                    .HasConstraintName("FK_TPRD_Product_C_SKUCode");

                entity.HasOne(d => d.C_SpotCodeNavigation)
                    .WithMany(p => p.TPRD_Products)
                    .HasForeignKey(d => d.C_SpotCode)
                    .HasConstraintName("FK_TPRD_Product_C_SpotCode");

                entity.HasOne(d => d.C_StoreCodeNavigation)
                    .WithMany(p => p.TPRD_Products)
                    .HasPrincipalKey(p => p.C_Code)
                    .HasForeignKey(d => d.C_StoreCode)
                    .OnDelete(DeleteBehavior.ClientSetNull)
                    .HasConstraintName("FK_TPRD_Product_C_StoreCode");
            });

            modelBuilder.Entity<TPRD_Type>(entity =>
            {
                entity.HasKey(e => e.C_Code)
                    .HasName("PRIMARY");

                entity.ToTable("TPRD_Type");

                entity.HasIndex(e => e.C_CreateBy, "FK_TPRD_Type_C_CreateBy");

                entity.HasIndex(e => e.C_LastUpdatedBy, "FK_TPRD_Type_C_LastUpdatedBy");

                entity.Property(e => e.C_Code)
                    .ValueGeneratedNever()
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_CreateBy)
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_LastUpdatedBy)
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_Name)
                    .IsRequired()
                    .HasColumnType("varchar(50)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_Status)
                    .IsRequired()
                    .HasColumnType("char(1)")
                    .HasDefaultValueSql("'1'")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.D_CreateOn).HasColumnType("datetime");

                entity.Property(e => e.D_LastUpdatedOn).HasColumnType("datetime");

                entity.Property(e => e.I_IfFPP).HasColumnType("int(11)");

                entity.Property(e => e.I_Sort).HasColumnType("int(11)");

                entity.HasOne(d => d.C_CreateByNavigation)
                    .WithMany(p => p.TPRD_TypeC_CreateByNavigations)
                    .HasForeignKey(d => d.C_CreateBy)
                    .OnDelete(DeleteBehavior.ClientSetNull)
                    .HasConstraintName("FK_TPRD_Type_C_CreateBy");

                entity.HasOne(d => d.C_LastUpdatedByNavigation)
                    .WithMany(p => p.TPRD_TypeC_LastUpdatedByNavigations)
                    .HasForeignKey(d => d.C_LastUpdatedBy)
                    .HasConstraintName("FK_TPRD_Type_C_LastUpdatedBy");
            });

            modelBuilder.Entity<TSYS_License>(entity =>
            {
                entity.HasKey(e => e.C_ID)
                    .HasName("PRIMARY");

                entity.ToTable("TSYS_License");

                entity.HasIndex(e => e.C_Code, "AK_Key")
                    .IsUnique();

                entity.HasIndex(e => e.C_CreateBy, "FK_TSYS_License_C_CreateBy");

                entity.HasIndex(e => e.C_LastUpdatedBy, "FK_TSYS_License_C_LastUpdatedBy");

                entity.HasIndex(e => e.C_TypeCode, "FK_TSYS_License_C_TypeCode");

                entity.Property(e => e.C_ID)
                    .ValueGeneratedNever()
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_Code)
                    .IsRequired()
                    .HasColumnType("varchar(50)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_CreateBy)
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_FilePath)
                    .IsRequired()
                    .HasColumnType("varchar(500)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_LastUpdatedBy)
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_Name)
                    .IsRequired()
                    .HasColumnType("varchar(100)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_Remark)
                    .HasColumnType("varchar(500)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_Status)
                    .IsRequired()
                    .HasColumnType("char(1)")
                    .HasDefaultValueSql("'1'")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_TypeCode)
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.D_CreateOn).HasColumnType("datetime");

                entity.Property(e => e.D_EndDate).HasColumnType("datetime");

                entity.Property(e => e.D_LastUpdatedOn).HasColumnType("datetime");

                entity.Property(e => e.D_StartDate).HasColumnType("datetime");

                entity.Property(e => e.I_MemberQty).HasColumnType("int(11)");

                entity.Property(e => e.I_Sort).HasColumnType("int(11)");

                entity.Property(e => e.I_SpotQty).HasColumnType("int(11)");

                entity.HasOne(d => d.C_CreateByNavigation)
                    .WithMany(p => p.TSYS_LicenseC_CreateByNavigations)
                    .HasForeignKey(d => d.C_CreateBy)
                    .OnDelete(DeleteBehavior.ClientSetNull)
                    .HasConstraintName("FK_TSYS_License_C_CreateBy");

                entity.HasOne(d => d.C_LastUpdatedByNavigation)
                    .WithMany(p => p.TSYS_LicenseC_LastUpdatedByNavigations)
                    .HasForeignKey(d => d.C_LastUpdatedBy)
                    .HasConstraintName("FK_TSYS_License_C_LastUpdatedBy");

                entity.HasOne(d => d.C_TypeCodeNavigation)
                    .WithMany(p => p.TSYS_Licenses)
                    .HasForeignKey(d => d.C_TypeCode)
                    .OnDelete(DeleteBehavior.ClientSetNull)
                    .HasConstraintName("FK_TSYS_License_C_TypeCode");
            });

            modelBuilder.Entity<TSYS_LicenseType>(entity =>
            {
                entity.HasKey(e => e.C_Code)
                    .HasName("PRIMARY");

                entity.ToTable("TSYS_LicenseType");

                entity.HasIndex(e => e.C_CreateBy, "FK_TSYS_LicenseType_C_CreateBy");

                entity.HasIndex(e => e.C_LastUpdatedBy, "FK_TSYS_LicenseType_C_LastUpdatedBy");

                entity.Property(e => e.C_Code)
                    .ValueGeneratedNever()
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_CreateBy)
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_LastUpdatedBy)
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_Name)
                    .IsRequired()
                    .HasColumnType("varchar(100)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_Remark)
                    .HasColumnType("varchar(500)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_Status)
                    .IsRequired()
                    .HasColumnType("char(1)")
                    .HasDefaultValueSql("'1'")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.D_CreateOn).HasColumnType("datetime");

                entity.Property(e => e.D_LastUpdatedOn).HasColumnType("datetime");

                entity.Property(e => e.I_MaxFileSize).HasColumnType("int(11)");

                entity.Property(e => e.I_MaxMemberQty).HasColumnType("int(11)");

                entity.Property(e => e.I_MaxSpotQty).HasColumnType("int(11)");

                entity.Property(e => e.I_Sort).HasColumnType("int(11)");

                entity.HasOne(d => d.C_CreateByNavigation)
                    .WithMany(p => p.TSYS_LicenseTypeC_CreateByNavigations)
                    .HasForeignKey(d => d.C_CreateBy)
                    .OnDelete(DeleteBehavior.ClientSetNull)
                    .HasConstraintName("FK_TSYS_LicenseType_C_CreateBy");

                entity.HasOne(d => d.C_LastUpdatedByNavigation)
                    .WithMany(p => p.TSYS_LicenseTypeC_LastUpdatedByNavigations)
                    .HasForeignKey(d => d.C_LastUpdatedBy)
                    .HasConstraintName("FK_TSYS_LicenseType_C_LastUpdatedBy");
            });

            modelBuilder.Entity<TSYS_LicenseTypePriv>(entity =>
            {
                entity.HasKey(e => new { e.C_LicenseTypeCode, e.C_PrivilegeCode })
                    .HasName("PRIMARY")
                    .HasAnnotation("MySql:IndexPrefixLength", new[] { 0, 0 });

                entity.ToTable("TSYS_LicenseTypePriv");

                entity.HasIndex(e => e.C_CreateBy, "FK_TSYS_LicenseTypePriv_C_CreateBy");

                entity.HasIndex(e => e.C_PrivilegeCode, "FK_TSYS_LicenseTypePriv_C_PrivilegeCode");

                entity.Property(e => e.C_LicenseTypeCode)
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_PrivilegeCode)
                    .HasColumnType("varchar(50)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_CreateBy)
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.D_CreateOn).HasColumnType("datetime");

                entity.HasOne(d => d.C_CreateByNavigation)
                    .WithMany(p => p.TSYS_LicenseTypePrivs)
                    .HasForeignKey(d => d.C_CreateBy)
                    .OnDelete(DeleteBehavior.ClientSetNull)
                    .HasConstraintName("FK_TSYS_LicenseTypePriv_C_CreateBy");

                entity.HasOne(d => d.C_LicenseTypeCodeNavigation)
                    .WithMany(p => p.TSYS_LicenseTypePrivs)
                    .HasForeignKey(d => d.C_LicenseTypeCode)
                    .OnDelete(DeleteBehavior.ClientSetNull)
                    .HasConstraintName("FK_TSYS_LicenseTypePriv_C_LicenseTypeCode");

                entity.HasOne(d => d.C_PrivilegeCodeNavigation)
                    .WithMany(p => p.TSYS_LicenseTypePrivs)
                    .HasForeignKey(d => d.C_PrivilegeCode)
                    .OnDelete(DeleteBehavior.ClientSetNull)
                    .HasConstraintName("FK_TSYS_LicenseTypePriv_C_PrivilegeCode");
            });

            modelBuilder.Entity<TSYS_Message>(entity =>
            {
                entity.HasKey(e => e.C_ID)
                    .HasName("PRIMARY");
                entity.ToTable("TSYS_Message");
            });

            modelBuilder.Entity<TSYS_Org>(entity =>
            {
                entity.HasKey(e => e.K_ID)
                    .HasName("PRIMARY");

                entity.ToTable("TSYS_Org");

                entity.HasIndex(e => e.C_Code, "AK_Key")
                    .IsUnique();

                entity.HasIndex(e => e.C_CreateBy, "FK_TSYS_Org_C_CreateBy");

                entity.HasIndex(e => e.C_LastUpdatedBy, "FK_TSYS_Org_C_LastUpdatedBy");

                entity.HasIndex(e => e.C_LicenseCode, "FK_TSYS_Org_C_LicenseCode");

                entity.HasIndex(e => e.C_ParentCode, "FK_TSYS_Org_C_ParentCode");

                entity.Property(e => e.K_ID).HasColumnType("int(11)");

                entity.Property(e => e.C_Code)
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_CreateBy)
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_GIS)
                    .HasColumnType("varchar(50)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_LName)
                    .HasColumnType("varchar(2550)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_LastUpdatedBy)
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_Level)
                    .IsRequired()
                    .HasColumnType("varchar(500)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_LicenseCode)
                    .IsRequired()
                    .HasColumnType("varchar(50)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_Linker)
                    .HasColumnType("varchar(50)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_Name)
                    .IsRequired()
                    .HasColumnType("varchar(100)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_ParentCode)
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_Phone)
                    .HasColumnType("varchar(50)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_Remark)
                    .HasColumnType("varchar(500)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_SName)
                    .HasColumnType("varchar(16)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_Status)
                    .IsRequired()
                    .HasColumnType("char(1)")
                    .HasDefaultValueSql("'1'")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_Type)
                    .IsRequired()
                    .HasColumnType("varchar(50)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.D_CreateOn).HasColumnType("datetime");

                entity.Property(e => e.D_LastUpdatedOn).HasColumnType("datetime");

                entity.Property(e => e.I_Sort).HasColumnType("int(11)");

                entity.HasOne(d => d.C_CreateByNavigation)
                    .WithMany(p => p.TSYS_OrgC_CreateByNavigations)
                    .HasForeignKey(d => d.C_CreateBy)
                    .OnDelete(DeleteBehavior.ClientSetNull)
                    .HasConstraintName("FK_TSYS_Org_C_CreateBy");

                entity.HasOne(d => d.C_LastUpdatedByNavigation)
                    .WithMany(p => p.TSYS_OrgC_LastUpdatedByNavigations)
                    .HasForeignKey(d => d.C_LastUpdatedBy)
                    .HasConstraintName("FK_TSYS_Org_C_LastUpdatedBy");

                entity.HasOne(d => d.C_LicenseCodeNavigation)
                    .WithMany(p => p.TSYS_Orgs)
                    .HasPrincipalKey(p => p.C_Code)
                    .HasForeignKey(d => d.C_LicenseCode)
                    .OnDelete(DeleteBehavior.ClientSetNull)
                    .HasConstraintName("FK_TSYS_Org_C_LicenseCode");

                entity.HasOne(d => d.C_ParentCodeNavigation)
                    .WithMany(p => p.InverseC_ParentCodeNavigation)
                    .HasPrincipalKey(p => p.C_Code)
                    .HasForeignKey(d => d.C_ParentCode)
                    .HasConstraintName("FK_TSYS_Org_C_ParentCode");
            });

            modelBuilder.Entity<TSYS_Priv>(entity =>
            {
                entity.HasKey(e => e.C_Code)
                    .HasName("PRIMARY");

                entity.ToTable("TSYS_Priv");

                entity.HasIndex(e => e.C_ParentCode, "FK_TSYS_Priv_C_ParentCode");

                entity.Property(e => e.C_Code)
                    .HasColumnType("varchar(50)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_ImageUrl)
                    .HasColumnType("varchar(100)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_Module)
                    .IsRequired()
                    .HasColumnType("varchar(50)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_Name)
                    .IsRequired()
                    .HasColumnType("varchar(50)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_PageUrl)
                    .HasColumnType("varchar(500)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_ParentCode)
                    .HasColumnType("varchar(50)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_Remark)
                    .HasColumnType("varchar(100)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_Status)
                    .IsRequired()
                    .HasColumnType("char(1)")
                    .HasDefaultValueSql("'1'")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_Type)
                    .IsRequired()
                    .HasColumnType("varchar(50)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.I_Sort).HasColumnType("int(11)");

                entity.HasOne(d => d.C_ParentCodeNavigation)
                    .WithMany(p => p.InverseC_ParentCodeNavigation)
                    .HasForeignKey(d => d.C_ParentCode)
                    .HasConstraintName("FK_TSYS_Priv_C_ParentCode");
            });

            modelBuilder.Entity<TSYS_Role>(entity =>
            {
                entity.HasKey(e => e.C_Code)
                    .HasName("PRIMARY");

                entity.ToTable("TSYS_Role");

                entity.HasIndex(e => e.C_CreateBy, "FK_TSYS_Role_C_CreateBy");

                entity.HasIndex(e => e.C_LastUpdatedBy, "FK_TSYS_Role_C_LastUpdatedBy");

                entity.HasIndex(e => e.C_LicenseCode, "FK_TSYS_Role_C_LicenseCode");

                entity.Property(e => e.C_Code)
                    .ValueGeneratedNever()
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_CreateBy)
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_Description)
                    .IsRequired()
                    .HasColumnType("varchar(100)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_LastUpdatedBy)
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_LicenseCode)
                    .IsRequired()
                    .HasColumnType("varchar(50)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_Name)
                    .IsRequired()
                    .HasColumnType("varchar(50)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_Status)
                    .IsRequired()
                    .HasColumnType("char(1)")
                    .HasDefaultValueSql("'1'")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.D_CreateOn).HasColumnType("datetime");

                entity.Property(e => e.D_LastUpdatedOn).HasColumnType("datetime");

                entity.Property(e => e.I_Sort).HasColumnType("int(11)");

                entity.HasOne(d => d.C_CreateByNavigation)
                    .WithMany(p => p.TSYS_RoleC_CreateByNavigations)
                    .HasForeignKey(d => d.C_CreateBy)
                    .OnDelete(DeleteBehavior.ClientSetNull)
                    .HasConstraintName("FK_TSYS_Role_C_CreateBy");

                entity.HasOne(d => d.C_LastUpdatedByNavigation)
                    .WithMany(p => p.TSYS_RoleC_LastUpdatedByNavigations)
                    .HasForeignKey(d => d.C_LastUpdatedBy)
                    .HasConstraintName("FK_TSYS_Role_C_LastUpdatedBy");

                entity.HasOne(d => d.C_LicenseCodeNavigation)
                    .WithMany(p => p.TSYS_Roles)
                    .HasPrincipalKey(p => p.C_Code)
                    .HasForeignKey(d => d.C_LicenseCode)
                    .OnDelete(DeleteBehavior.ClientSetNull)
                    .HasConstraintName("FK_TSYS_Role_C_LicenseCode");
            });

            modelBuilder.Entity<TSYS_RolePriv>(entity =>
            {
                entity.HasKey(e => new { e.C_RoleCode, e.C_PrivilegeCode })
                    .HasName("PRIMARY")
                    .HasAnnotation("MySql:IndexPrefixLength", new[] { 0, 0 });

                entity.ToTable("TSYS_RolePriv");

                entity.HasIndex(e => e.C_CreateBy, "FK_TSYS_RolePriv_C_CreateBy");

                entity.HasIndex(e => e.C_PrivilegeCode, "FK_TSYS_RolePriv_C_PrivilegeCode");

                entity.Property(e => e.C_RoleCode)
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_PrivilegeCode)
                    .HasColumnType("varchar(50)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_CreateBy)
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.D_CreateOn).HasColumnType("datetime");

                entity.Property(e => e.I_Type).HasColumnType("int(11)");

                entity.HasOne(d => d.C_CreateByNavigation)
                    .WithMany(p => p.TSYS_RolePrivs)
                    .HasForeignKey(d => d.C_CreateBy)
                    .OnDelete(DeleteBehavior.ClientSetNull)
                    .HasConstraintName("FK_TSYS_RolePriv_C_CreateBy");

                entity.HasOne(d => d.C_PrivilegeCodeNavigation)
                    .WithMany(p => p.TSYS_RolePrivs)
                    .HasForeignKey(d => d.C_PrivilegeCode)
                    .OnDelete(DeleteBehavior.ClientSetNull)
                    .HasConstraintName("FK_TSYS_RolePriv_C_PrivilegeCode");

                entity.HasOne(d => d.C_RoleCodeNavigation)
                    .WithMany(p => p.TSYS_RolePrivs)
                    .HasForeignKey(d => d.C_RoleCode)
                    .OnDelete(DeleteBehavior.ClientSetNull)
                    .HasConstraintName("FK_TSYS_RolePriv_C_RoleCode");
            });

            modelBuilder.Entity<TSYS_User>(entity =>
            {
                entity.HasKey(e => e.C_UserID)
                    .HasName("PRIMARY");

                entity.ToTable("TSYS_User");

                entity.HasIndex(e => e.C_UserName, "AK_Key")
                    .IsUnique();

                entity.HasIndex(e => e.C_IDNum, "AK_Key_2")
                    .IsUnique();

                entity.HasIndex(e => e.C_Mobile, "AK_Key_3")
                    .IsUnique();

                entity.HasIndex(e => e.C_CreateBy, "FK_TSYS_User_C_CreateBy");

                entity.HasIndex(e => e.C_LastUpdatedBy, "FK_TSYS_User_C_LastUpdatedBy");

                entity.HasIndex(e => e.C_LicenseCode, "FK_TSYS_User_C_LicenseCode");

                entity.HasIndex(e => e.C_OrgCode, "FK_TSYS_User_C_OrgCode");

                entity.Property(e => e.C_UserID)
                    .ValueGeneratedNever()
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_Address)
                    .HasColumnType("varchar(500)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_CreateBy)
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_Email)
                    .HasColumnType("varchar(50)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_IDNum)
                    .HasColumnType("varchar(50)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_ImagePath)
                    .HasColumnType("varchar(500)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_LastUpdatedBy)
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_LicenseCode)
                    .IsRequired()
                    .HasColumnType("varchar(50)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_Mobile)
                    .IsRequired()
                    .HasColumnType("varchar(20)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_Name)
                    .IsRequired()
                    .HasColumnType("varchar(50)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_OrgCode)
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_Password)
                    .IsRequired()
                    .HasColumnType("varchar(100)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_Phone)
                    .HasColumnType("varchar(20)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_Post)
                    .HasColumnType("varchar(50)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_ProgramID)
                    .HasColumnType("varchar(100)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_Remark)
                    .HasColumnType("varchar(500)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_Status)
                    .IsRequired()
                    .HasColumnType("char(1)")
                    .HasDefaultValueSql("'1'")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_UserName)
                    .IsRequired()
                    .HasColumnType("varchar(50)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_WechatID)
                    .HasColumnType("varchar(100)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.D_Birthday).HasColumnType("datetime");

                entity.Property(e => e.D_CreateOn).HasColumnType("datetime");

                entity.Property(e => e.D_LastUpdatedOn).HasColumnType("datetime");

                entity.Property(e => e.I_Render).HasColumnType("int(11)");

                entity.Property(e => e.I_Sort).HasColumnType("int(11)");

                entity.HasOne(d => d.C_CreateByNavigation)
                    .WithMany(p => p.InverseC_CreateByNavigation)
                    .HasForeignKey(d => d.C_CreateBy)
                    .HasConstraintName("FK_TSYS_User_C_CreateBy");

                entity.HasOne(d => d.C_LastUpdatedByNavigation)
                    .WithMany(p => p.InverseC_LastUpdatedByNavigation)
                    .HasForeignKey(d => d.C_LastUpdatedBy)
                    .OnDelete(DeleteBehavior.Cascade)
                    .HasConstraintName("FK_TSYS_User_C_LastUpdatedBy");

                entity.HasOne(d => d.C_LicenseCodeNavigation)
                    .WithMany(p => p.TSYS_Users)
                    .HasPrincipalKey(p => p.C_Code)
                    .HasForeignKey(d => d.C_LicenseCode)
                    .OnDelete(DeleteBehavior.ClientSetNull)
                    .HasConstraintName("FK_TSYS_User_C_LicenseCode");

                entity.HasOne(d => d.C_OrgCodeNavigation)
                    .WithMany(p => p.TSYS_Users)
                    .HasPrincipalKey(p => p.C_Code)
                    .HasForeignKey(d => d.C_OrgCode)
                    .HasConstraintName("FK_TSYS_User_C_OrgCode");
            });

            modelBuilder.Entity<TSYS_UserRole>(entity =>
            {
                entity.HasKey(e => new { e.C_UserCode, e.C_RoleCode })
                    .HasName("PRIMARY")
                    .HasAnnotation("MySql:IndexPrefixLength", new[] { 0, 0 });

                entity.ToTable("TSYS_UserRole");

                entity.HasIndex(e => e.C_CreateBy, "FK_TSYS_UserRole_C_CreateBy");

                entity.HasIndex(e => e.C_RoleCode, "FK_TSYS_UserRole_C_RoleCode");

                entity.Property(e => e.C_UserCode)
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_RoleCode)
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_CreateBy)
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.D_CreateOn).HasColumnType("datetime");

                entity.HasOne(d => d.C_CreateByNavigation)
                    .WithMany(p => p.TSYS_UserRoleC_CreateByNavigations)
                    .HasForeignKey(d => d.C_CreateBy)
                    .OnDelete(DeleteBehavior.ClientSetNull)
                    .HasConstraintName("FK_TSYS_UserRole_C_CreateBy");

                entity.HasOne(d => d.C_RoleCodeNavigation)
                    .WithMany(p => p.TSYS_UserRoles)
                    .HasForeignKey(d => d.C_RoleCode)
                    .OnDelete(DeleteBehavior.ClientSetNull)
                    .HasConstraintName("FK_TSYS_UserRole_C_RoleCode");

                entity.HasOne(d => d.C_UserCodeNavigation)
                    .WithMany(p => p.TSYS_UserRoleC_UserCodeNavigations)
                    .HasForeignKey(d => d.C_UserCode)
                    .OnDelete(DeleteBehavior.ClientSetNull)
                    .HasConstraintName("FK_TSYS_UserRole_C_UserCode");
            });

            modelBuilder.Entity<TSYS_Version>(entity =>
            {
                entity.HasKey(e => e.C_ID)
                    .HasName("PRIMARY");

                entity.ToTable("TSYS_Version");

                entity.HasIndex(e => e.C_CreateBy, "FK_TSYS_Version_C_CreateBy");

                entity.HasIndex(e => e.C_LastUpdatedBy, "FK_TSYS_Version_C_LastUpdatedBy");

                entity.Property(e => e.C_ID)
                    .ValueGeneratedNever()
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_AppCode)
                    .IsRequired()
                    .HasColumnType("varchar(50)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_CreateBy)
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_DownloadURL)
                    .HasColumnType("varchar(1000)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_LastUpdatedBy)
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_Status)
                    .IsRequired()
                    .HasColumnType("char(1)")
                    .HasDefaultValueSql("'1'")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_UpdateContent)
                    .HasColumnType("varchar(1000)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_VersionCode)
                    .HasColumnType("varchar(50)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.D_CreateOn).HasColumnType("datetime");

                entity.Property(e => e.D_LastUpdatedOn).HasColumnType("datetime");

                entity.HasOne(d => d.C_CreateByNavigation)
                    .WithMany(p => p.TSYS_VersionC_CreateByNavigations)
                    .HasForeignKey(d => d.C_CreateBy)
                    .OnDelete(DeleteBehavior.ClientSetNull)
                    .HasConstraintName("FK_TSYS_Version_C_CreateBy");

                entity.HasOne(d => d.C_LastUpdatedByNavigation)
                    .WithMany(p => p.TSYS_VersionC_LastUpdatedByNavigations)
                    .HasForeignKey(d => d.C_LastUpdatedBy)
                    .HasConstraintName("FK_TSYS_Version_C_LastUpdatedBy");
            });

            modelBuilder.Entity<TaskInfoDto>(entity =>
            {
                entity.HasKey(e => e.jobId)
                    .HasName("PRIMARY");

                entity.ToTable("TaskInfoDto");

                entity.HasIndex(e => e.TasksQzId, "IX_TaskInfoDto_TasksQzId");

                entity.Property(e => e.jobId)
                    .HasColumnType("varchar(255)")
                    .HasCharSet("utf8mb4")
                    .HasCollation("utf8mb4_general_ci");

                entity.Property(e => e.TasksQzId)
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.jobGroup)
                    .HasColumnType("longtext")
                    .HasCharSet("utf8mb4")
                    .HasCollation("utf8mb4_general_ci");

                entity.Property(e => e.jobName)
                    .HasColumnType("longtext")
                    .HasCharSet("utf8mb4")
                    .HasCollation("utf8mb4_general_ci");

                entity.Property(e => e.triggerGroup)
                    .HasColumnType("longtext")
                    .HasCharSet("utf8mb4")
                    .HasCollation("utf8mb4_general_ci");

                entity.Property(e => e.triggerId)
                    .HasColumnType("longtext")
                    .HasCharSet("utf8mb4")
                    .HasCollation("utf8mb4_general_ci");

                entity.Property(e => e.triggerName)
                    .HasColumnType("longtext")
                    .HasCharSet("utf8mb4")
                    .HasCollation("utf8mb4_general_ci");

                entity.Property(e => e.triggerStatus)
                    .HasColumnType("longtext")
                    .HasCharSet("utf8mb4")
                    .HasCollation("utf8mb4_general_ci");

                entity.HasOne(d => d.TasksQz)
                    .WithMany(p => p.TaskInfoDtos)
                    .HasForeignKey(d => d.TasksQzId)
                    .HasConstraintName("TaskInfoDto_ibfk_1");
            });

            modelBuilder.Entity<TasksQz>(entity =>
            {
                entity.ToTable("TasksQz");

                entity.Property(e => e.Id)
                    .ValueGeneratedNever()
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.AssemblyName)
                    .HasColumnType("varchar(200)")
                    .HasCharSet("utf8mb4")
                    .HasCollation("utf8mb4_general_ci");

                entity.Property(e => e.BeginTime).HasMaxLength(6);

                entity.Property(e => e.C_StoreCode)
                    .IsRequired()
                    .HasColumnType("varchar(50)")
                    .HasCharSet("utf8mb4")
                    .HasCollation("utf8mb4_general_ci");

                entity.Property(e => e.ClassName)
                    .HasColumnType("varchar(200)")
                    .HasCharSet("utf8mb4")
                    .HasCollation("utf8mb4_general_ci");

                entity.Property(e => e.CreateBy)
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.CreateTime).HasMaxLength(6);

                entity.Property(e => e.Cron)
                    .HasColumnType("varchar(200)")
                    .HasCharSet("utf8mb4")
                    .HasCollation("utf8mb4_general_ci");

                entity.Property(e => e.CycleRunTimes).HasColumnType("int(11)");

                entity.Property(e => e.EndTime).HasMaxLength(6);

                entity.Property(e => e.IntervalSecond).HasColumnType("int(11)");

                entity.Property(e => e.JobGroup)
                    .HasColumnType("varchar(200)")
                    .HasCharSet("utf8mb4")
                    .HasCollation("utf8mb4_general_ci");

                entity.Property(e => e.JobParams)
                    .HasColumnType("longtext")
                    .HasCharSet("utf8mb4")
                    .HasCollation("utf8mb4_general_ci");

                entity.Property(e => e.Name)
                    .HasColumnType("varchar(200)")
                    .HasCharSet("utf8mb4")
                    .HasCollation("utf8mb4_general_ci");

                entity.Property(e => e.Remark)
                    .HasColumnType("varchar(1000)")
                    .HasCharSet("utf8mb4")
                    .HasCollation("utf8mb4_general_ci");

                entity.Property(e => e.RunTimes).HasColumnType("int(11)");

                entity.Property(e => e.TriggerType).HasColumnType("int(11)");
            });

            modelBuilder.Entity<TSYS_RoleHand>(entity =>
            {
                entity.HasKey(e => new {  e.C_RoleCode,e.C_HandCode })
                    .HasName("PRIMARY")
                    .HasAnnotation("MySql:IndexPrefixLength", new[] { 0, 0 });

                entity.ToTable("TSYS_RoleHand");

                entity.Property(e => e.C_HandCode)
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_RoleCode)
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_CreateBy)
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.D_CreateOn).HasColumnType("datetime");

            });

            modelBuilder.Entity<TSYS_LicenseLargeScreenTemplate>(entity =>
            {
                entity.HasKey(e => new { e.C_LicenseCode, e.C_LargeScreenTemplateCode })
                    .HasName("PRIMARY")
                    .HasAnnotation("MySql:IndexPrefixLength", new[] { 0, 0 });

                entity.ToTable("TSYS_LicenseLargeScreenTemplate");

                entity.HasIndex(e => e.C_CreateBy, "FK_TSYS_LicenseLargeScreenTemplate_C_CreateBy");

                entity.HasIndex(e => e.C_LargeScreenTemplateCode, "FK_TSYS_LicenseLargeScreenTemplate_C_RoleCode");

                entity.Property(e => e.C_LicenseCode)
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_LargeScreenTemplateCode)
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.C_CreateBy)
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.D_CreateOn).HasColumnType("datetime");
            });

            modelBuilder.Entity<TaicAiboxTemplate>(entity =>
            {
                entity.HasKey(e => e.CId)
                    .HasName("PRIMARY");

                entity.HasComment("AI盒子模版表");

                entity.Property(e => e.CId)
                    .HasComment("Guid")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.CContactPhone)
                    .HasComment("联系电话")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.CContacts)
                    .HasComment("联系人")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.CCreateBy)
                    .HasComment("记录创建人")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.CIconPath)
                    .HasComment("图标路径")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.CImagePath)
                    .HasComment("照片路径")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.CLastUpdatedBy)
                    .HasComment("记录修改人")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.CManufacturer)
                    .HasComment("制造商")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.CMarker)
                    .HasComment("型号")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.CName)
                    .HasComment("名称")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.COfficialWebsiteUrl)
                    .HasComment("官网")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.CParameter)
                    .HasComment("参数")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.CProdArea)
                    .HasComment("产地")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.CQrcode)
                    .HasComment("二维码")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.CRemark)
                    .HasComment("备注")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.CStatus)
                    .HasComment("状态 1启用,0禁用")
                    .HasCharSet("utf8mb4")
                    .HasCollation("utf8mb4_unicode_ci");

                entity.Property(e => e.CThreeDpath)
                    .HasComment("3D路径")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.DCreateOn)
                    .HasDefaultValueSql("CURRENT_TIMESTAMP")
                    .HasComment("记录创建时间");

                entity.Property(e => e.DLastUpdatedOn).HasComment("记录创建时间");

                entity.Property(e => e.ISort).HasComment("排序号");

                entity.Property(e => e.IValiDays).HasComment("有效期");
            });

            modelBuilder.Entity<TaicAibox>(entity =>
            {
                entity.HasKey(e => e.CId)
                    .HasName("PRIMARY");

                entity.HasComment("AI盒子表");

                entity.Property(e => e.CId)
                    .HasComment("guid主键")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.CAiboxNo)
                    .HasComment("编号")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.CAiboxTemplateCode)
                    .HasComment("模板编号")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.CCfgUrl)
                    .HasComment("配置地址")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.CCreateBy)
                    .HasComment("记录创建人")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.CLastUpdatedBy)
                    .HasComment("记录修改人")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.CMachineCode)
                    .HasComment("设备码(序列号)")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.CName)
                    .HasComment("名称")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.CQrcode)
                    .HasComment("二维码")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.CRemark)
                    .HasComment("备注")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.CRunStatus).HasComment("4=报警\r\n3=预警\r\n2=掉线\r\n1=在线\r\n0=故障");

                entity.Property(e => e.CStatus).HasComment("3=报废\r\n2=停用 \r\n1=启用、分配、业主已购买\r\n0=禁用");

                entity.Property(e => e.CStoreCode)
                    .HasComment("网点(业主)编号")
                    .HasCharSet("utf8")
                    .HasCollation("utf8_general_ci");

                entity.Property(e => e.DCreateOn)
                    .HasDefaultValueSql("CURRENT_TIMESTAMP")
                    .HasComment("记录创建时间");

                entity.Property(e => e.DLastUpdatedOn).HasComment("记录修改时间");

                entity.Property(e => e.DProdDate).HasComment("生产日期");

                entity.Property(e => e.I_Sort).HasComment("排序号");
            });

            modelBuilder.Entity<TaicAiboxMigrate>(entity =>
            {
                entity.HasKey(e => e.CId)
                    .HasName("PRIMARY");

                entity.HasComment("AI盒子迁移表");

                entity.Property(e => e.CId)
                    .HasComment("Guid")
                    .HasCharSet("utf8mb4")
                    .HasCollation("utf8mb4_unicode_ci");

                entity.Property(e => e.CAiboxCode)
                    .HasComment("AI盒子ID")
                    .HasCharSet("utf8mb4")
                    .HasCollation("utf8mb4_unicode_ci");

                entity.Property(e => e.CCreateBy)
                    .HasComment("记录创建人")
                    .HasCharSet("utf8mb4")
                    .HasCollation("utf8mb4_unicode_ci");

                entity.Property(e => e.CCurrentStoreCode)
                    .HasComment("当前业主编号")
                    .HasCharSet("utf8mb4")
                    .HasCollation("utf8mb4_unicode_ci");

                entity.Property(e => e.CLastStoreCode)
                    .HasComment("上家业主编号")
                    .HasCharSet("utf8mb4")
                    .HasCollation("utf8mb4_unicode_ci");

                entity.Property(e => e.CName)
                    .HasComment("名称")
                    .HasCharSet("utf8mb4")
                    .HasCollation("utf8mb4_unicode_ci");

                entity.Property(e => e.CRemark)
                    .HasComment("备注")
                    .HasCharSet("utf8mb4")
                    .HasCollation("utf8mb4_unicode_ci");

                entity.Property(e => e.DCreateOn)
                    .HasComment("记录创建时间")
                    .HasCharSet("utf8mb4")
                    .HasCollation("utf8mb4_unicode_ci");
            });

            modelBuilder.Entity<TaicDevAibox>(entity =>
            {
                entity.HasKey(e => e.CId)
                    .HasName("PRIMARY");

                entity.HasComment("设备AI盒子表");

                entity.Property(e => e.CId)
                    .HasComment("GUID")
                    .HasCharSet("utf8mb4")
                    .HasCollation("utf8mb4_unicode_ci");

                entity.Property(e => e.CAiboxCode)
                    .HasComment("AI盒子ID")
                    .HasCharSet("utf8mb4")
                    .HasCollation("utf8mb4_unicode_ci");

                entity.Property(e => e.CCameraCode)
                    .HasComment("摄像头ID")
                    .HasCharSet("utf8mb4")
                    .HasCollation("utf8mb4_unicode_ci");

                entity.Property(e => e.CCreateBy)
                    .HasComment("记录创建人")
                    .HasCharSet("utf8mb4")
                    .HasCollation("utf8mb4_unicode_ci");

                entity.Property(e => e.CCreator)
                    .HasComment("创建人")
                    .HasCharSet("utf8mb4")
                    .HasCollation("utf8mb4_unicode_ci");

                entity.Property(e => e.DCreateOn)
                    .HasDefaultValueSql("CURRENT_TIMESTAMP")
                    .HasComment("记录创建时间");
            });

            OnModelCreatingPartial(modelBuilder);
        }

        partial void OnModelCreatingPartial(ModelBuilder modelBuilder);
    }
}