WinFormTools/WinformGeneralDeveloperFrame/DB.cs

50 lines
1.4 KiB
C#
Raw Normal View History

2021-04-13 17:46:18 +08:00
using System;
using System.ComponentModel.DataAnnotations.Schema;
2021-07-02 17:35:46 +08:00
using System.Configuration;
2021-04-13 17:46:18 +08:00
using System.Data.Entity;
using System.Linq;
using MES.Entity;
2021-07-02 17:35:46 +08:00
using WinformGeneralDeveloperFrame.Commons;
2021-04-13 17:46:18 +08:00
//using MES.Entity;
namespace WinformGeneralDeveloperFrame
{
public partial class DB : DbContext
{
public DB()
2021-07-02 17:35:46 +08:00
: base(EncodeHelper.AES_Decrypt(ConfigurationManager.ConnectionStrings["DB"].ConnectionString))
2021-04-13 17:46:18 +08:00
{
}
public virtual DbSet<sysDataBase> sysDataBase { get; set; }
public virtual DbSet<sysDataTableInfo> sysDataTableInfo { get; set; }
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
modelBuilder.Entity<sysDataBase>()
.Property(e => e.name)
.IsUnicode(false);
modelBuilder.Entity<sysDataBase>()
.Property(e => e.serverip)
.IsUnicode(false);
modelBuilder.Entity<sysDataBase>()
.Property(e => e.databasename)
.IsUnicode(false);
modelBuilder.Entity<sysDataBase>()
.Property(e => e.connecturl)
.IsUnicode(false);
modelBuilder.Entity<sysDataBase>()
.Property(e => e.username)
.IsUnicode(false);
modelBuilder.Entity<sysDataBase>()
.Property(e => e.passsword)
.IsUnicode(false);
}
}
}