|
|
#nullable disable
|
|
|
|
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
using Microsoft.Extensions.Logging;
|
|
|
|
|
|
namespace Monitor.Models
|
|
|
{
|
|
|
public partial class MyDbContext : DbContext
|
|
|
{
|
|
|
public static readonly ILoggerFactory MyLogFactory = LoggerFactory.Create(build =>
|
|
|
{
|
|
|
build.AddDebug(); // 用于VS调试,输出窗口的输出
|
|
|
});
|
|
|
|
|
|
public MyDbContext()
|
|
|
{
|
|
|
}
|
|
|
|
|
|
public MyDbContext(DbContextOptions<MyDbContext> options)
|
|
|
: base(options)
|
|
|
{
|
|
|
}
|
|
|
|
|
|
public virtual DbSet<TEgElecDayStatistic> TEgElecDayStatistics { get; set; }
|
|
|
public virtual DbSet<TEgElecHourStatistic> TEgElecHourStatistics { get; set; }
|
|
|
public virtual DbSet<TEgEmeterDayEnergyValue> TEgEmeterDayEnergyValues { get; set; }
|
|
|
public virtual DbSet<TEgEmeterHourEnergyValue> TEgEmeterHourEnergyValues { get; set; }
|
|
|
public virtual DbSet<TEgEmeterRealEnergyValue> TEgEmeterRealEnergyValues { get; set; }
|
|
|
public virtual DbSet<TEgEmeterTotalEnergyValue> TEgEmeterTotalEnergyValues { get; set; }
|
|
|
|
|
|
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
|
|
{
|
|
|
optionsBuilder.UseLoggerFactory(MyLogFactory);
|
|
|
if (!optionsBuilder.IsConfigured)
|
|
|
{
|
|
|
// optionsBuilder.UseMySql("server=127.0.0.1;user id=root;password=root;database=xiexin_test", Microsoft.EntityFrameworkCore.ServerVersion.Parse("5.7.26-mysql"));
|
|
|
}
|
|
|
}
|
|
|
|
|
|
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
|
|
{
|
|
|
modelBuilder.Entity<TEgElecDayStatistic>(entity =>
|
|
|
{
|
|
|
entity.HasKey(e => e.FId)
|
|
|
.HasName("PRIMARY");
|
|
|
|
|
|
entity.ToTable("t_eg_elec_day_statistics");
|
|
|
|
|
|
entity.HasComment(" 换电站每天用电统计")
|
|
|
;
|
|
|
|
|
|
entity.Property(e => e.FId)
|
|
|
.HasColumnType("bigint(20)")
|
|
|
.HasColumnName("f_id")
|
|
|
.HasComment("序号");
|
|
|
|
|
|
entity.Property(e => e.FDayChargingValue)
|
|
|
.HasColumnName("f_day_charging_value")
|
|
|
.HasComment("每天计算充电能耗值");
|
|
|
|
|
|
entity.Property(e => e.FDayOtherValue)
|
|
|
.HasColumnName("f_day_other_value")
|
|
|
.HasComment("每天计算其它能耗值");
|
|
|
|
|
|
entity.Property(e => e.FDaySwitchingValue)
|
|
|
.HasColumnName("f_day_switching_value")
|
|
|
.HasComment("每天计算换电能耗值");
|
|
|
|
|
|
entity.Property(e => e.FDayTotalValue)
|
|
|
.HasColumnName("f_day_total_value")
|
|
|
.HasComment("每天计算总量能耗值");
|
|
|
|
|
|
entity.Property(e => e.FEndTime)
|
|
|
.HasColumnType("datetime")
|
|
|
.HasColumnName("f_end_time")
|
|
|
.HasComment("结束时间");
|
|
|
|
|
|
entity.Property(e => e.FStartTime)
|
|
|
.HasColumnType("datetime")
|
|
|
.HasColumnName("f_start_time")
|
|
|
.HasComment("开始时间");
|
|
|
});
|
|
|
|
|
|
modelBuilder.Entity<TEgElecHourStatistic>(entity =>
|
|
|
{
|
|
|
entity.HasKey(e => e.FId)
|
|
|
.HasName("PRIMARY");
|
|
|
|
|
|
entity.ToTable("t_eg_elec_hour_statistics");
|
|
|
|
|
|
entity.HasComment("换电站分时用电统计")
|
|
|
;
|
|
|
|
|
|
entity.Property(e => e.FId)
|
|
|
.HasColumnType("bigint(20)")
|
|
|
.HasColumnName("f_id")
|
|
|
.HasComment("序号");
|
|
|
|
|
|
entity.Property(e => e.FEndTime)
|
|
|
.HasColumnType("datetime")
|
|
|
.HasColumnName("f_end_time")
|
|
|
.HasComment("结束时间");
|
|
|
|
|
|
entity.Property(e => e.FHourChargingValue)
|
|
|
.HasColumnType("float(11,0)")
|
|
|
.HasColumnName("f_hour_charging_value")
|
|
|
.HasComment("小时计算充电能耗值");
|
|
|
|
|
|
entity.Property(e => e.FHourOtherValue)
|
|
|
.HasColumnType("float(11,0)")
|
|
|
.HasColumnName("f_hour_other_value")
|
|
|
.HasComment("小时计算其它能耗值");
|
|
|
|
|
|
entity.Property(e => e.FHourSwitchingValue)
|
|
|
.HasColumnType("float(11,0)")
|
|
|
.HasColumnName("f_hour_switching_value")
|
|
|
.HasComment("小时计算换电能耗值");
|
|
|
|
|
|
entity.Property(e => e.FHourTotalValue)
|
|
|
.HasColumnType("float(11,0)")
|
|
|
.HasColumnName("f_hour_total_value")
|
|
|
.HasComment("小时计算总量能耗值");
|
|
|
|
|
|
entity.Property(e => e.FStartTime)
|
|
|
.HasColumnType("datetime")
|
|
|
.HasColumnName("f_start_time")
|
|
|
.HasComment("开始时间");
|
|
|
});
|
|
|
|
|
|
modelBuilder.Entity<TEgEmeterDayEnergyValue>(entity =>
|
|
|
{
|
|
|
entity.HasKey(e => e.FId)
|
|
|
.HasName("PRIMARY");
|
|
|
|
|
|
entity.ToTable("t_eg_emeter_day_energy_value");
|
|
|
|
|
|
entity.HasComment("电能表每天能耗值")
|
|
|
;
|
|
|
|
|
|
entity.Property(e => e.FId)
|
|
|
.HasColumnType("bigint(20)")
|
|
|
.HasColumnName("f_id")
|
|
|
.HasComment("序号");
|
|
|
|
|
|
entity.Property(e => e.FDayValue)
|
|
|
.HasColumnType("float(11,0)")
|
|
|
.HasColumnName("f_day_value")
|
|
|
.HasComment("日变化值。单位:kWh,保留两位小数");
|
|
|
|
|
|
entity.Property(e => e.FEmeterNo)
|
|
|
.IsRequired()
|
|
|
.HasMaxLength(20)
|
|
|
.HasColumnName("f_emeter_no")
|
|
|
.HasComment("电表编码");
|
|
|
|
|
|
entity.Property(e => e.FEndTime)
|
|
|
.HasColumnType("datetime")
|
|
|
.HasColumnName("f_end_time")
|
|
|
.HasComment("结束时间");
|
|
|
|
|
|
entity.Property(e => e.FStartTime)
|
|
|
.HasColumnType("datetime")
|
|
|
.HasColumnName("f_start_time")
|
|
|
.HasComment("开始时间");
|
|
|
});
|
|
|
|
|
|
modelBuilder.Entity<TEgEmeterHourEnergyValue>(entity =>
|
|
|
{
|
|
|
entity.HasKey(e => e.FId)
|
|
|
.HasName("PRIMARY");
|
|
|
|
|
|
entity.ToTable("t_eg_emeter_hour_energy_value");
|
|
|
|
|
|
entity.HasComment("电能表小时能耗值")
|
|
|
;
|
|
|
|
|
|
entity.Property(e => e.FId)
|
|
|
.HasColumnType("bigint(20)")
|
|
|
.HasColumnName("f_id")
|
|
|
.HasComment("序号");
|
|
|
|
|
|
entity.Property(e => e.FEmeterNo)
|
|
|
.IsRequired()
|
|
|
.HasMaxLength(20)
|
|
|
.HasColumnName("f_emeter_no")
|
|
|
.HasComment("电表编码");
|
|
|
|
|
|
entity.Property(e => e.FEndTime)
|
|
|
.HasColumnType("datetime")
|
|
|
.HasColumnName("f_end_time")
|
|
|
.HasComment("结束时间");
|
|
|
|
|
|
entity.Property(e => e.FHourValue)
|
|
|
.HasColumnType("float(11,0)")
|
|
|
.HasColumnName("f_hour_value")
|
|
|
.HasComment("小时变化值。单位:kWh,保留两位小数");
|
|
|
|
|
|
entity.Property(e => e.FStartTime)
|
|
|
.HasColumnType("datetime")
|
|
|
.HasColumnName("f_start_time")
|
|
|
.HasComment("开始时间");
|
|
|
});
|
|
|
|
|
|
modelBuilder.Entity<TEgEmeterRealEnergyValue>(entity =>
|
|
|
{
|
|
|
entity.HasKey(e => e.FId)
|
|
|
.HasName("PRIMARY");
|
|
|
|
|
|
entity.ToTable("t_eg_emeter_real_energy_value");
|
|
|
|
|
|
entity.HasComment("电能表变化值信息")
|
|
|
;
|
|
|
|
|
|
entity.Property(e => e.FId)
|
|
|
.HasColumnType("bigint(20)")
|
|
|
.HasColumnName("f_id")
|
|
|
.HasComment("序号");
|
|
|
|
|
|
entity.Property(e => e.FEmeterNo)
|
|
|
.IsRequired()
|
|
|
.HasMaxLength(20)
|
|
|
.HasColumnName("f_emeter_no")
|
|
|
.HasComment("电表编码");
|
|
|
|
|
|
entity.Property(e => e.FEndTime)
|
|
|
.HasColumnType("datetime")
|
|
|
.HasColumnName("f_end_time")
|
|
|
.HasComment("结束时间");
|
|
|
|
|
|
entity.Property(e => e.FRealValue)
|
|
|
.HasColumnType("float(11,0)")
|
|
|
.HasColumnName("f_real_value")
|
|
|
.HasComment("变化值");
|
|
|
|
|
|
entity.Property(e => e.FStartTime)
|
|
|
.HasColumnType("datetime")
|
|
|
.HasColumnName("f_start_time")
|
|
|
.HasComment("开始时间");
|
|
|
});
|
|
|
|
|
|
modelBuilder.Entity<TEgEmeterTotalEnergyValue>(entity =>
|
|
|
{
|
|
|
entity.HasKey(e => e.FId)
|
|
|
.HasName("PRIMARY");
|
|
|
|
|
|
entity.ToTable("t_eg_emeter_total_energy_value");
|
|
|
|
|
|
entity.HasComment("电能表累计值信息")
|
|
|
;
|
|
|
|
|
|
entity.Property(e => e.FId)
|
|
|
.HasColumnType("bigint(20)")
|
|
|
.HasColumnName("f_id")
|
|
|
.HasComment("序号");
|
|
|
|
|
|
entity.Property(e => e.FEmeterNo)
|
|
|
.IsRequired()
|
|
|
.HasMaxLength(20)
|
|
|
.HasColumnName("f_emeter_no")
|
|
|
.HasComment("电表编码");
|
|
|
|
|
|
entity.Property(e => e.FTime)
|
|
|
.HasColumnType("datetime")
|
|
|
.HasColumnName("f_time")
|
|
|
.HasComment("更新时间");
|
|
|
|
|
|
entity.Property(e => e.FTotalValue)
|
|
|
.HasColumnName("f_total_value")
|
|
|
.HasComment("累积值");
|
|
|
});
|
|
|
|
|
|
OnModelCreatingPartial(modelBuilder);
|
|
|
}
|
|
|
|
|
|
partial void OnModelCreatingPartial(ModelBuilder modelBuilder);
|
|
|
}
|
|
|
} |