47 lines
2.0 KiB
C#
47 lines
2.0 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
namespace IRaCIS.Core.Test.GenerateContextModelFolder;
|
|
|
|
public partial class TempContext : DbContext
|
|
{
|
|
public TempContext()
|
|
{
|
|
}
|
|
|
|
public TempContext(DbContextOptions<TempContext> options)
|
|
: base(options)
|
|
{
|
|
}
|
|
|
|
public virtual DbSet<Dictionary> Dictionaries { get; set; }
|
|
|
|
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
|
#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 https://go.microsoft.com/fwlink/?LinkId=723263.
|
|
=> optionsBuilder.UseSqlServer("Server=106.14.89.110,1435;Database=Test_IRC;User ID=sa;Password=xc@123456;TrustServerCertificate=true");
|
|
|
|
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
|
{
|
|
modelBuilder.UseCollation("Chinese_PRC_CI_AS");
|
|
|
|
modelBuilder.Entity<Dictionary>(entity =>
|
|
{
|
|
entity.ToTable("Dictionary", tb => tb.HasComment("后台 - 字典表(需要同步)"));
|
|
|
|
entity.Property(e => e.Id).ValueGeneratedNever();
|
|
entity.Property(e => e.ChildGroup).HasDefaultValue("");
|
|
entity.Property(e => e.Code).HasDefaultValue("");
|
|
entity.Property(e => e.DataTypeEnum).HasComment("字典类型- 枚举|bool|下拉框");
|
|
entity.Property(e => e.IsConfig).HasComment("是否字典类型配置");
|
|
entity.Property(e => e.IsEnable).HasDefaultValue(true);
|
|
entity.Property(e => e.Value).HasDefaultValue("");
|
|
entity.Property(e => e.ValueCN).HasDefaultValue("");
|
|
});
|
|
|
|
OnModelCreatingPartial(modelBuilder);
|
|
}
|
|
|
|
partial void OnModelCreatingPartial(ModelBuilder modelBuilder);
|
|
}
|