Files
mapo-core/MP.Data/MoonPro_STATSContext.cs
T
Samuele Locatelli 84a769cfcf Bozza gestione DDB
2021-05-17 19:28:41 +02:00

260 lines
7.9 KiB
C#

using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.Extensions.Configuration;
using MP.Data.DatabaseModels;
using NLog;
#nullable disable
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<MoonPro_STATSContext> options)
: base(options)
{
}
#endregion Public Constructors
#region Public Properties
public virtual DbSet<AzioniUL> DbSetAzioniUL { get; set; }
public virtual DbSet<ResControlli> DbSetControlli { get; set; }
public virtual DbSet<DdbTurni> DbSetDdbTurni { get; set; }
public virtual DbSet<ResScarti> DbSetScarti { get; set; }
public virtual DbSet<UserActionLog> DbSetUserLog { 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(_configuration.GetConnectionString("Mp.Stats"));
//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<DdbTurni>(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<AzioniUL>(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<ResScarti>(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<ResControlli>(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<UserActionLog>(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);
});
OnModelCreatingPartial(modelBuilder);
}
#endregion Protected Methods
}
}