using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Configuration; using MP.Data.DbModels; using MP.Data.DbModels.Energy; using NLog; #nullable disable // // This is here so CodeMaid doesn't reorganize this document // namespace MP.Data { public partial class MoonPro_STATSContext : DbContext { #region Private Fields private static NLog.Logger Log = LogManager.GetCurrentClassLogger(); private IConfiguration _configuration; #endregion Private Fields #region Public Constructors public MoonPro_STATSContext(IConfiguration configuration) { _configuration = configuration; } public MoonPro_STATSContext(DbContextOptions options) : base(options) { } #endregion Public Constructors #region Public Properties public virtual DbSet DbSetDbSize { get; set; } public virtual DbSet DbSetAnagFLTrans { get; set; } public virtual DbSet DbSetArticoli { get; set; } public virtual DbSet DbSetAzioniUL { get; set; } public virtual DbSet DbSetConfig { get; set; } public virtual DbSet DbSetControlli { get; set; } public virtual DbSet DbSetDdbTurni { get; set; } public virtual DbSet DbSetFL { get; set; } public virtual DbSet DbSetMacchine { get; set; } public virtual DbSet DbSetMacchineCheck { get; set; } public virtual DbSet DbSetODL { get; set; } public virtual DbSet DbSetOdlEnergy { get; set; } public virtual DbSet DbSetScarti { get; set; } public virtual DbSet DbSetTurniOee { get; set; } public virtual DbSet DbSetUserLog { get; set; } public virtual DbSet DbSetVocabolario { get; set; } public virtual DbSet DbSetMaccStat { get; set; } #endregion Public Properties #region Private Methods partial void OnModelCreatingPartial(ModelBuilder modelBuilder); #endregion Private Methods #region Protected Methods protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) { if (!optionsBuilder.IsConfigured) { string connString = _configuration.GetConnectionString("MP.Stats"); optionsBuilder.UseSqlServer(connString); //optionsBuilder.UseSqlServer("Server=SQL2016DEV;Database=MoonPro_STATS;Trusted_Connection=True;"); } } protected override void OnModelCreating(ModelBuilder modelBuilder) { modelBuilder.HasAnnotation("Relational:Collation", "SQL_Latin1_General_CP1_CI_AS"); modelBuilder.Entity(entity => { entity.HasKey(e => e.Chiave); entity.ToTable("Config"); entity.Property(e => e.Chiave) .HasMaxLength(50) .HasColumnName("chiave"); entity.Property(e => e.Note).HasColumnName("note"); entity.Property(e => e.Valore).HasColumnName("valore"); entity.Property(e => e.ValoreStd) .HasColumnName("valoreStd") .HasComment("Valore di default/riferimento per la variabile"); }); modelBuilder.Entity(entity => { entity.HasKey(e => new { e.IdxMacchina, e.dtEvento, e.CodFlux }); }); modelBuilder.Entity(entity => { entity.HasKey(e => new { e.Lingua, e.Lemma }); }); modelBuilder.Entity(entity => { entity.HasNoKey(); entity.ToView("v_UI_OEE_Turni"); entity.Property(e => e.ClasseTempo).HasMaxLength(50); entity.Property(e => e.CodArticolo) .IsRequired() .HasMaxLength(50); entity.Property(e => e.CodMacchina).HasMaxLength(50); entity.Property(e => e.DataRif).HasColumnType("datetime"); entity.Property(e => e.DescArticolo).HasMaxLength(250); entity.Property(e => e.IdxMacchina) .IsRequired() .HasMaxLength(50); entity.Property(e => e.TotPeriodo).HasColumnName("totPeriodo"); entity.Property(e => e.Turno) .IsRequired() .HasMaxLength(5); }); modelBuilder.Entity(entity => { entity.HasNoKey(); entity.ToView("v_UI_MaccEnergyCheck"); }); modelBuilder.Entity(entity => { entity.HasNoKey(); entity.ToView("v_UI_AnagArticoli"); entity.Property(e => e.CodArticolo) .IsRequired() .HasMaxLength(50); entity.Property(e => e.DescArticolo) .IsRequired() .HasMaxLength(250); entity.Property(e => e.Disegno) .IsRequired() .HasMaxLength(50); entity.Property(e => e.Tipo) .IsRequired() .HasMaxLength(50); }); modelBuilder.Entity(entity => { entity.HasNoKey(); entity.ToView("v_UI_Macchine"); entity.Property(e => e.CodMacchina).HasMaxLength(50); entity.Property(e => e.Descrizione).HasMaxLength(50); entity.Property(e => e.IdxMacchina) .IsRequired() .HasMaxLength(50); entity.Property(e => e.Nome).HasMaxLength(50); }); modelBuilder.Entity(entity => { entity.ToView("v_UI_MaccEnergy"); }); modelBuilder.Entity(entity => { entity.HasNoKey(); entity.ToView("v_UI_DDB_Turni"); entity.Property(e => e.ClasseTempo).HasMaxLength(50); entity.Property(e => e.CodArticolo) .IsRequired() .HasMaxLength(50); entity.Property(e => e.CodMacchina).HasMaxLength(50); entity.Property(e => e.DataRif).HasColumnType("datetime"); entity.Property(e => e.DataTurnoFine).HasColumnType("datetime"); entity.Property(e => e.DataTurnoInizio).HasColumnType("datetime"); entity.Property(e => e.Descrizione).HasMaxLength(50); entity.Property(e => e.FinePeriodo).HasColumnType("datetime"); entity.Property(e => e.FineStato).HasColumnType("datetime"); entity.Property(e => e.IdxMacchina) .IsRequired() .HasMaxLength(50); entity.Property(e => e.IdxOdl).HasColumnName("IdxODL"); entity.Property(e => e.InizioPeriodo).HasColumnType("datetime"); entity.Property(e => e.InizioStato).HasColumnType("datetime"); entity.Property(e => e.KeyRichiesta).HasMaxLength(50); entity.Property(e => e.Pallet) .HasMaxLength(20) .HasColumnName("pallet"); entity.Property(e => e.TempoCicloBase).HasColumnType("decimal(18, 8)"); entity.Property(e => e.Turno) .IsRequired() .HasMaxLength(5); }); modelBuilder.Entity(entity => { entity.HasKey(e => e.Azione); entity.ToTable("AAUL"); entity.Property(e => e.Azione) .HasMaxLength(50) .HasDefaultValueSql("('ND')") .HasComment("Azione dell'operatore"); entity.Property(e => e.Class) .IsRequired() .HasMaxLength(50) .HasDefaultValueSql("('')"); entity.Property(e => e.Descrizione) .IsRequired() .HasMaxLength(50) .HasDefaultValueSql("('')"); }); modelBuilder.Entity(entity => { entity.HasNoKey(); entity.ToView("v_UI_RS"); entity.Property(e => e.Causale) .IsRequired() .HasMaxLength(50); entity.Property(e => e.CodArticolo) .IsRequired() .HasMaxLength(50); entity.Property(e => e.CodMacchina).HasMaxLength(50); entity.Property(e => e.Cognome) .IsRequired() .HasMaxLength(50); entity.Property(e => e.DataOraRif).HasColumnType("datetime"); entity.Property(e => e.Descrizione) .IsRequired() .HasMaxLength(250); entity.Property(e => e.IdxMacchina) .IsRequired() .HasMaxLength(50); entity.Property(e => e.IdxOdl).HasColumnName("IdxODL"); entity.Property(e => e.KeyRichiesta) .IsRequired() .HasMaxLength(50); entity.Property(e => e.Nome) .IsRequired() .HasMaxLength(50); entity.Property(e => e.Note) .IsRequired() .HasMaxLength(250); }); modelBuilder.Entity(entity => { entity.HasNoKey(); entity.ToView("vRC"); entity.Property(e => e.CodArticolo) .IsRequired() .HasMaxLength(50); entity.Property(e => e.DataOra).HasColumnType("datetime"); entity.Property(e => e.EsitoOk).HasColumnName("EsitoOK"); entity.Property(e => e.IdxControllo).ValueGeneratedOnAdd(); entity.Property(e => e.IdxMacchina) .IsRequired() .HasMaxLength(50); entity.Property(e => e.IdxOdl).HasColumnName("IdxODL"); entity.Property(e => e.Note) .IsRequired() .HasMaxLength(250); }); modelBuilder.Entity(entity => { entity.HasNoKey(); entity.ToView("v_UI_UL"); entity.Property(e => e.Azione) .IsRequired() .HasMaxLength(50); entity.Property(e => e.CodArticolo) .IsRequired() .HasMaxLength(50); entity.Property(e => e.CodMacchina).HasMaxLength(50); entity.Property(e => e.Cognome) .IsRequired() .HasMaxLength(50); entity.Property(e => e.DataOraRif).HasColumnType("datetime"); entity.Property(e => e.IdxMacchina) .IsRequired() .HasMaxLength(50); entity.Property(e => e.IdxOdl).HasColumnName("IdxODL"); entity.Property(e => e.KeyRichiesta) .IsRequired() .HasMaxLength(50); entity.Property(e => e.Nome) .IsRequired() .HasMaxLength(50); entity.Property(e => e.Qta).HasColumnType("decimal(18, 8)"); entity.Property(e => e.Valore) .IsRequired() .HasMaxLength(250); }); modelBuilder.Entity(entity => { entity.HasKey(e => e.IdxOdl) .HasName("PK_ODL_1"); entity.ToTable("v_UI_ODL"); entity.Property(e => e.IdxOdl) .ValueGeneratedNever() .HasColumnName("IdxODL"); entity.Property(e => e.CodArticolo) .IsRequired() .HasMaxLength(50); entity.Property(e => e.CodArticoloParent) .IsRequired() .HasDefaultValueSql("('')"); entity.Property(e => e.DataFine).HasColumnType("datetime"); entity.Property(e => e.DataInizio).HasColumnType("datetime"); entity.Property(e => e.DueDate).HasColumnType("datetime"); entity.Property(e => e.IdxMacchina).HasMaxLength(50); entity.Property(e => e.KeyRichiesta) .IsRequired() .HasMaxLength(50) .HasComment("Chiave: Ordine esterno o KIT"); entity.Property(e => e.KeyRichiestaParent) .IsRequired() .HasDefaultValueSql("('')") .HasComment("Chiave: Ordine esterno o KIT"); entity.Property(e => e.PzPallet).HasDefaultValueSql("((1))"); entity.Property(e => e.Tcassegnato) .HasColumnType("decimal(18, 8)") .HasColumnName("TCAssegnato"); }); OnModelCreatingPartial(modelBuilder); } #endregion Protected Methods } }