Fix context x metodi necessari
This commit is contained in:
@@ -1,63 +0,0 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace GPW.Data.DBModels
|
||||
{
|
||||
public partial class GPWContext : DbContext
|
||||
{
|
||||
public GPWContext()
|
||||
{
|
||||
}
|
||||
|
||||
public GPWContext(DbContextOptions<GPWContext> options)
|
||||
: base(options)
|
||||
{
|
||||
}
|
||||
|
||||
public virtual DbSet<CheckVc19> CheckVc19s { get; set; }
|
||||
|
||||
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
||||
{
|
||||
if (!optionsBuilder.IsConfigured)
|
||||
{
|
||||
#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 http://go.microsoft.com/fwlink/?LinkId=723263.
|
||||
optionsBuilder.UseSqlServer("Server=SQLSTEAM;Database=GPW;Trusted_Connection=True;");
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||
{
|
||||
modelBuilder.HasAnnotation("Relational:Collation", "Latin1_General_CI_AS");
|
||||
|
||||
modelBuilder.Entity<CheckVc19>(entity =>
|
||||
{
|
||||
entity.HasKey(e => e.IdxCheck)
|
||||
.HasName("PK_CheckC19");
|
||||
|
||||
entity.ToTable("CheckVC19");
|
||||
|
||||
entity.Property(e => e.IdxCheck).ValueGeneratedNever();
|
||||
|
||||
entity.Property(e => e.DtCheck)
|
||||
.HasColumnType("datetime")
|
||||
.HasColumnName("dtCheck")
|
||||
.HasDefaultValueSql("(getdate())");
|
||||
|
||||
entity.Property(e => e.IdxDipendente).HasColumnName("idxDipendente");
|
||||
|
||||
entity.Property(e => e.Payload)
|
||||
.IsRequired()
|
||||
.HasMaxLength(500)
|
||||
.HasColumnName("payload")
|
||||
.HasDefaultValueSql("('')");
|
||||
});
|
||||
|
||||
OnModelCreatingPartial(modelBuilder);
|
||||
}
|
||||
|
||||
partial void OnModelCreatingPartial(ModelBuilder modelBuilder);
|
||||
}
|
||||
}
|
||||
+360
-238
@@ -2,6 +2,9 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using GPW.Data.DBModels;
|
||||
using NLog.Fluent;
|
||||
using NLog;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
|
||||
#nullable disable
|
||||
|
||||
@@ -9,66 +12,134 @@ namespace GPW.Data
|
||||
{
|
||||
public partial class GPWContext : DbContext
|
||||
{
|
||||
#region Private Fields
|
||||
|
||||
private static NLog.Logger Log = LogManager.GetCurrentClassLogger();
|
||||
|
||||
private IConfiguration _configuration;
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Public Constructors
|
||||
|
||||
public GPWContext()
|
||||
{
|
||||
}
|
||||
|
||||
public GPWContext(DbContextOptions<GPWContext> options)
|
||||
: base(options)
|
||||
public GPWContext(IConfiguration configuration)
|
||||
{
|
||||
_configuration = configuration;
|
||||
}
|
||||
|
||||
public GPWContext(DbContextOptions<GPWContext> options) : base(options)
|
||||
{
|
||||
try
|
||||
{
|
||||
// se non ci fosse... crea o migra!
|
||||
Database.Migrate();
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Error(exc, "Exception during context initialization 02");
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Public Constructors
|
||||
|
||||
#if false
|
||||
public virtual DbSet<AnagClassiOrarie> AnagClassiOraries { get; set; }
|
||||
|
||||
public virtual DbSet<AnagClienti> AnagClientis { get; set; }
|
||||
|
||||
public virtual DbSet<AnagDevice> AnagDevices { get; set; }
|
||||
|
||||
public virtual DbSet<AnagFasi> AnagFasis { get; set; }
|
||||
|
||||
public virtual DbSet<AnagGiust> AnagGiusts { get; set; }
|
||||
|
||||
public virtual DbSet<AnagGruppi> AnagGruppis { get; set; }
|
||||
|
||||
public virtual DbSet<AnagKeyValue> AnagKeyValues { get; set; }
|
||||
|
||||
public virtual DbSet<AnagOrari> AnagOraris { get; set; }
|
||||
|
||||
public virtual DbSet<AnagProgetti> AnagProgettis { get; set; }
|
||||
|
||||
public virtual DbSet<AnagraficaEventi> AnagraficaEventis { get; set; }
|
||||
|
||||
public virtual DbSet<AnagRuoli> AnagRuolis { get; set; }
|
||||
|
||||
public virtual DbSet<AnagTipoCheck> AnagTipoChecks { get; set; }
|
||||
|
||||
public virtual DbSet<AnagTipoTimb> AnagTipoTimbs { get; set; }
|
||||
|
||||
public virtual DbSet<CalendFesteFerie> CalendFesteFeries { get; set; }
|
||||
|
||||
public virtual DbSet<Config> Configs { get; set; }
|
||||
|
||||
public virtual DbSet<Contatori> Contatoris { get; set; }
|
||||
|
||||
public virtual DbSet<ControlloDefrag> ControlloDefrags { get; set; }
|
||||
|
||||
public virtual DbSet<Dipendenti2Ruoli> Dipendenti2Ruolis { get; set; }
|
||||
|
||||
public virtual DbSet<ElencoReport> ElencoReports { get; set; }
|
||||
|
||||
public virtual DbSet<Funzioni> Funzionis { get; set; }
|
||||
|
||||
public virtual DbSet<Giustificativi> Giustificativis { get; set; }
|
||||
|
||||
public virtual DbSet<ImportEgaltech> ImportEgalteches { get; set; }
|
||||
|
||||
public virtual DbSet<ImportEgaltechFase> ImportEgaltechFases { get; set; }
|
||||
|
||||
public virtual DbSet<ImportEgaltechNew> ImportEgaltechNews { get; set; }
|
||||
|
||||
public virtual DbSet<ListValue> ListValues { get; set; }
|
||||
|
||||
public virtual DbSet<LogAttivitum> LogAttivita { get; set; }
|
||||
|
||||
public virtual DbSet<LogUpdateDb> LogUpdateDbs { get; set; }
|
||||
|
||||
public virtual DbSet<OreMensiliExport> OreMensiliExports { get; set; }
|
||||
|
||||
public virtual DbSet<PeriodiLav> PeriodiLavs { get; set; }
|
||||
|
||||
public virtual DbSet<Permessi2Funzione> Permessi2Funziones { get; set; }
|
||||
|
||||
public virtual DbSet<Permessi> Permessis { get; set; }
|
||||
|
||||
public virtual DbSet<RegAttivitum> RegAttivita { get; set; }
|
||||
|
||||
public virtual DbSet<RegAttivitaEgal> RegAttivitaEgals { get; set; }
|
||||
|
||||
public virtual DbSet<RegAttivitaExpl> RegAttivitaExpls { get; set; }
|
||||
|
||||
public virtual DbSet<RegistroEventi> RegistroEventis { get; set; }
|
||||
|
||||
public virtual DbSet<RilievoTemp> RilievoTemps { get; set; }
|
||||
|
||||
public virtual DbSet<Sottoscrizioni> Sottoscrizionis { get; set; }
|
||||
|
||||
public virtual DbSet<StoricoAnagFasi> StoricoAnagFasis { get; set; }
|
||||
|
||||
public virtual DbSet<StoricoAnagProgetti> StoricoAnagProgettis { get; set; }
|
||||
|
||||
public virtual DbSet<TabWol> TabWols { get; set; }
|
||||
|
||||
public virtual DbSet<Tally> Tallies { get; set; }
|
||||
|
||||
public virtual DbSet<TimbratureExpl> TimbratureExpls { get; set; }
|
||||
|
||||
public virtual DbSet<TransizioneEventi> TransizioneEventis { get; set; }
|
||||
#endif
|
||||
|
||||
#region Public Properties
|
||||
|
||||
public virtual DbSet<AnagClassiOrarie> AnagClassiOraries { get; set; }
|
||||
public virtual DbSet<AnagClienti> AnagClientis { get; set; }
|
||||
public virtual DbSet<AnagDevice> AnagDevices { get; set; }
|
||||
public virtual DbSet<AnagFasi> AnagFasis { get; set; }
|
||||
public virtual DbSet<AnagGiust> AnagGiusts { get; set; }
|
||||
public virtual DbSet<AnagGruppi> AnagGruppis { get; set; }
|
||||
public virtual DbSet<AnagKeyValue> AnagKeyValues { get; set; }
|
||||
public virtual DbSet<AnagOrari> AnagOraris { get; set; }
|
||||
public virtual DbSet<AnagProgetti> AnagProgettis { get; set; }
|
||||
public virtual DbSet<AnagraficaEventi> AnagraficaEventis { get; set; }
|
||||
public virtual DbSet<AnagRuoli> AnagRuolis { get; set; }
|
||||
public virtual DbSet<AnagTipoCheck> AnagTipoChecks { get; set; }
|
||||
public virtual DbSet<AnagTipoTimb> AnagTipoTimbs { get; set; }
|
||||
public virtual DbSet<CalendFesteFerie> CalendFesteFeries { get; set; }
|
||||
public virtual DbSet<Config> Configs { get; set; }
|
||||
public virtual DbSet<Contatori> Contatoris { get; set; }
|
||||
public virtual DbSet<ControlloDefrag> ControlloDefrags { get; set; }
|
||||
public virtual DbSet<Dipendenti2Ruoli> Dipendenti2Ruolis { get; set; }
|
||||
public virtual DbSet<Dipendenti> Dipendentis { get; set; }
|
||||
public virtual DbSet<ElencoReport> ElencoReports { get; set; }
|
||||
public virtual DbSet<Funzioni> Funzionis { get; set; }
|
||||
public virtual DbSet<Giustificativi> Giustificativis { get; set; }
|
||||
public virtual DbSet<ImportEgaltech> ImportEgalteches { get; set; }
|
||||
public virtual DbSet<ImportEgaltechFase> ImportEgaltechFases { get; set; }
|
||||
public virtual DbSet<ImportEgaltechNew> ImportEgaltechNews { get; set; }
|
||||
public virtual DbSet<ListValue> ListValues { get; set; }
|
||||
public virtual DbSet<LogAttivitum> LogAttivita { get; set; }
|
||||
public virtual DbSet<LogUpdateDb> LogUpdateDbs { get; set; }
|
||||
public virtual DbSet<OreMensiliExport> OreMensiliExports { get; set; }
|
||||
public virtual DbSet<PeriodiLav> PeriodiLavs { get; set; }
|
||||
public virtual DbSet<Permessi2Funzione> Permessi2Funziones { get; set; }
|
||||
public virtual DbSet<Permessi> Permessis { get; set; }
|
||||
public virtual DbSet<RegAttivitum> RegAttivita { get; set; }
|
||||
public virtual DbSet<RegAttivitaEgal> RegAttivitaEgals { get; set; }
|
||||
public virtual DbSet<RegAttivitaExpl> RegAttivitaExpls { get; set; }
|
||||
public virtual DbSet<RegistroEventi> RegistroEventis { get; set; }
|
||||
public virtual DbSet<RilievoTemp> RilievoTemps { get; set; }
|
||||
public virtual DbSet<Sottoscrizioni> Sottoscrizionis { get; set; }
|
||||
public virtual DbSet<StoricoAnagFasi> StoricoAnagFasis { get; set; }
|
||||
public virtual DbSet<StoricoAnagProgetti> StoricoAnagProgettis { get; set; }
|
||||
public virtual DbSet<TabWol> TabWols { get; set; }
|
||||
public virtual DbSet<Tally> Tallies { get; set; }
|
||||
public virtual DbSet<TimbratureExpl> TimbratureExpls { get; set; }
|
||||
public virtual DbSet<Timbrature> Timbratures { get; set; }
|
||||
public virtual DbSet<TransizioneEventi> TransizioneEventis { get; set; }
|
||||
public virtual DbSet<CheckVc19> DbSetCheckVc19 { get; set; }
|
||||
public virtual DbSet<Dipendenti> DbSetDipendenti { get; set; }
|
||||
|
||||
public virtual DbSet<Timbrature> DbSetTimbrature { get; set; }
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
@@ -84,7 +155,15 @@ namespace GPW.Data
|
||||
{
|
||||
if (!optionsBuilder.IsConfigured)
|
||||
{
|
||||
optionsBuilder.UseSqlServer("Server=SQLSTEAM;Database=GPW;Trusted_Connection=True;");
|
||||
string connString = _configuration.GetConnectionString("GPW.Data");
|
||||
if (!string.IsNullOrEmpty(connString))
|
||||
{
|
||||
optionsBuilder.UseSqlServer(connString);
|
||||
}
|
||||
else
|
||||
{
|
||||
optionsBuilder.UseSqlServer("Server=SQLSTEAM;Database=GPW;Trusted_Connection=True;");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -92,26 +171,27 @@ namespace GPW.Data
|
||||
{
|
||||
modelBuilder.HasAnnotation("Relational:Collation", "Latin1_General_CI_AS");
|
||||
|
||||
#if false
|
||||
modelBuilder.Entity<AnagClassiOrarie>(entity =>
|
||||
{
|
||||
entity.HasKey(e => e.CodClasse);
|
||||
{
|
||||
entity.HasKey(e => e.CodClasse);
|
||||
|
||||
entity.ToTable("AnagClassiOrarie");
|
||||
entity.ToTable("AnagClassiOrarie");
|
||||
|
||||
entity.Property(e => e.CodClasse)
|
||||
.HasMaxLength(10)
|
||||
.HasColumnName("codClasse")
|
||||
.HasComment("codice univoco");
|
||||
entity.Property(e => e.CodClasse)
|
||||
.HasMaxLength(10)
|
||||
.HasColumnName("codClasse")
|
||||
.HasComment("codice univoco");
|
||||
|
||||
entity.Property(e => e.DescrClasse)
|
||||
.HasMaxLength(250)
|
||||
.HasColumnName("descrClasse");
|
||||
entity.Property(e => e.DescrClasse)
|
||||
.HasMaxLength(250)
|
||||
.HasColumnName("descrClasse");
|
||||
|
||||
entity.Property(e => e.Peso)
|
||||
.HasColumnType("decimal(6, 3)")
|
||||
.HasColumnName("peso")
|
||||
.HasComment("peso (per calcolo ore \"produttive\")");
|
||||
});
|
||||
entity.Property(e => e.Peso)
|
||||
.HasColumnType("decimal(6, 3)")
|
||||
.HasColumnName("peso")
|
||||
.HasComment("peso (per calcolo ore \"produttive\")");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<AnagClienti>(entity =>
|
||||
{
|
||||
@@ -625,140 +705,6 @@ namespace GPW.Data
|
||||
.HasColumnName("type_desc");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<Dipendenti>(entity =>
|
||||
{
|
||||
entity.HasKey(e => e.IdxDipendente);
|
||||
|
||||
entity.ToTable("Dipendenti");
|
||||
|
||||
entity.Property(e => e.IdxDipendente).HasColumnName("idxDipendente");
|
||||
|
||||
entity.Property(e => e.Attivo)
|
||||
.HasColumnName("attivo")
|
||||
.HasDefaultValueSql("((1))");
|
||||
|
||||
entity.Property(e => e.AuthKey)
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
.HasColumnName("authKey")
|
||||
.HasDefaultValueSql("('##########')");
|
||||
|
||||
entity.Property(e => e.Cf)
|
||||
.IsRequired()
|
||||
.HasMaxLength(16)
|
||||
.HasColumnName("CF")
|
||||
.HasDefaultValueSql("('0000000000000000')");
|
||||
|
||||
entity.Property(e => e.CodDipendenteExt)
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
.HasColumnName("codDipendenteExt")
|
||||
.HasDefaultValueSql("('')")
|
||||
.HasComment("nome/codice dipendente per sistema esterno da importare");
|
||||
|
||||
entity.Property(e => e.CodHw)
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
.HasColumnName("codHw")
|
||||
.HasDefaultValueSql("('')");
|
||||
|
||||
entity.Property(e => e.CodOrario)
|
||||
.HasMaxLength(50)
|
||||
.HasColumnName("codOrario");
|
||||
|
||||
entity.Property(e => e.Cognome).HasMaxLength(50);
|
||||
|
||||
entity.Property(e => e.DataAssunzione)
|
||||
.HasColumnType("date")
|
||||
.HasColumnName("dataAssunzione")
|
||||
.HasDefaultValueSql("('1900-01-01')");
|
||||
|
||||
entity.Property(e => e.DataCessazione)
|
||||
.HasColumnType("date")
|
||||
.HasColumnName("dataCessazione")
|
||||
.HasDefaultValueSql("('9999-12-31')");
|
||||
|
||||
entity.Property(e => e.DataNascita)
|
||||
.HasColumnType("datetime")
|
||||
.HasColumnName("dataNascita");
|
||||
|
||||
entity.Property(e => e.Dominio)
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
.HasColumnName("dominio")
|
||||
.HasDefaultValueSql("('DOMINIO')");
|
||||
|
||||
entity.Property(e => e.Email)
|
||||
.IsRequired()
|
||||
.HasMaxLength(250)
|
||||
.HasColumnName("email")
|
||||
.HasDefaultValueSql("('')");
|
||||
|
||||
entity.Property(e => e.Gruppo)
|
||||
.HasMaxLength(50)
|
||||
.HasColumnName("gruppo")
|
||||
.HasDefaultValueSql("('NA')");
|
||||
|
||||
entity.Property(e => e.LuogoNascita)
|
||||
.HasMaxLength(50)
|
||||
.HasColumnName("luogoNascita");
|
||||
|
||||
entity.Property(e => e.MailDay)
|
||||
.HasColumnName("mailDay")
|
||||
.HasDefaultValueSql("((0))");
|
||||
|
||||
entity.Property(e => e.MailLastOp)
|
||||
.HasColumnName("mailLastOp")
|
||||
.HasDefaultValueSql("((0))");
|
||||
|
||||
entity.Property(e => e.MailMonth)
|
||||
.HasColumnName("mailMonth")
|
||||
.HasDefaultValueSql("((0))");
|
||||
|
||||
entity.Property(e => e.MailWeek)
|
||||
.HasColumnName("mailWeek")
|
||||
.HasDefaultValueSql("((0))");
|
||||
|
||||
entity.Property(e => e.Matricola)
|
||||
.HasMaxLength(50)
|
||||
.HasColumnName("matricola");
|
||||
|
||||
entity.Property(e => e.NazNascita)
|
||||
.HasMaxLength(50)
|
||||
.HasColumnName("nazNascita");
|
||||
|
||||
entity.Property(e => e.Nome).HasMaxLength(50);
|
||||
|
||||
entity.Property(e => e.NumAuth)
|
||||
.HasColumnName("numAuth")
|
||||
.HasDefaultValueSql("((0))")
|
||||
.HasComment("numero di impieghi della authKey");
|
||||
|
||||
entity.Property(e => e.ProvNascita)
|
||||
.HasMaxLength(50)
|
||||
.HasColumnName("provNascita");
|
||||
|
||||
entity.Property(e => e.Utente)
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
.HasColumnName("utente")
|
||||
.HasDefaultValueSql("('UTENTE')");
|
||||
|
||||
entity.Property(e => e.WolMac)
|
||||
.HasMaxLength(50)
|
||||
.HasColumnName("WOL_MAC");
|
||||
|
||||
entity.HasOne(d => d.CodOrarioNavigation)
|
||||
.WithMany(p => p.Dipendentis)
|
||||
.HasForeignKey(d => d.CodOrario)
|
||||
.HasConstraintName("FK_Dipendenti_AnagOrari");
|
||||
|
||||
entity.HasOne(d => d.GruppoNavigation)
|
||||
.WithMany(p => p.Dipendentis)
|
||||
.HasForeignKey(d => d.Gruppo)
|
||||
.HasConstraintName("FK_Dipendenti_AnagGruppi");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<Dipendenti2Ruoli>(entity =>
|
||||
{
|
||||
entity.HasKey(e => new { e.IdxDipendente, e.CodRuolo });
|
||||
@@ -1412,47 +1358,6 @@ namespace GPW.Data
|
||||
entity.ToTable("Tally");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<Timbrature>(entity =>
|
||||
{
|
||||
entity.HasKey(e => new { e.IdxDipendente, e.DataOra });
|
||||
|
||||
entity.ToTable("Timbrature");
|
||||
|
||||
entity.HasIndex(e => new { e.IdxDipendente, e.Entrata }, "ix_Timbrature_IdxDip_Entrata");
|
||||
|
||||
entity.Property(e => e.IdxDipendente).HasColumnName("idxDipendente");
|
||||
|
||||
entity.Property(e => e.DataOra)
|
||||
.HasColumnType("datetime")
|
||||
.HasColumnName("dataOra");
|
||||
|
||||
entity.Property(e => e.Approv)
|
||||
.HasDefaultValueSql("((0))")
|
||||
.HasComment("Approvazioen timbratura (default true...)");
|
||||
|
||||
entity.Property(e => e.CodTipoTimb)
|
||||
.HasMaxLength(10)
|
||||
.HasDefaultValueSql("(N'BC')");
|
||||
|
||||
entity.Property(e => e.Entrata).HasColumnName("entrata");
|
||||
|
||||
entity.Property(e => e.Ipv4)
|
||||
.HasMaxLength(15)
|
||||
.HasColumnName("IPv4")
|
||||
.HasDefaultValueSql("(N'0.0.0.0')");
|
||||
|
||||
entity.HasOne(d => d.CodTipoTimbNavigation)
|
||||
.WithMany(p => p.Timbratures)
|
||||
.HasForeignKey(d => d.CodTipoTimb)
|
||||
.HasConstraintName("FK_Timbrature_AnagTipoTimb");
|
||||
|
||||
entity.HasOne(d => d.IdxDipendenteNavigation)
|
||||
.WithMany(p => p.Timbratures)
|
||||
.HasForeignKey(d => d.IdxDipendente)
|
||||
.OnDelete(DeleteBehavior.ClientSetNull)
|
||||
.HasConstraintName("FK_Timbrature_Dipendenti");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<TimbratureExpl>(entity =>
|
||||
{
|
||||
entity.HasKey(e => new { e.DataLav, e.IdxDipendente })
|
||||
@@ -1633,10 +1538,227 @@ namespace GPW.Data
|
||||
.HasForeignKey(d => d.IdxTipoEvento)
|
||||
.HasConstraintName("FK_TransizioneEventi_AnagraficaEventi");
|
||||
});
|
||||
#endif
|
||||
|
||||
modelBuilder.Entity<CheckVc19>(entity =>
|
||||
{
|
||||
entity.HasKey(e => e.IdxCheck)
|
||||
.HasName("PK_CheckC19");
|
||||
|
||||
entity.ToTable("CheckVC19");
|
||||
|
||||
entity.Property(e => e.IdxCheck).ValueGeneratedNever();
|
||||
|
||||
entity.Property(e => e.DtCheck)
|
||||
.HasColumnType("datetime")
|
||||
.HasColumnName("dtCheck")
|
||||
.HasDefaultValueSql("(getdate())");
|
||||
|
||||
entity.Property(e => e.IdxDipendente).HasColumnName("idxDipendente");
|
||||
|
||||
entity.Property(e => e.Payload)
|
||||
.IsRequired()
|
||||
.HasMaxLength(500)
|
||||
.HasColumnName("payload")
|
||||
.HasDefaultValueSql("('')");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<Dipendenti>(entity =>
|
||||
{
|
||||
entity.HasKey(e => e.IdxDipendente);
|
||||
|
||||
entity.ToTable("Dipendenti");
|
||||
|
||||
entity.Property(e => e.IdxDipendente).HasColumnName("idxDipendente");
|
||||
|
||||
entity.Property(e => e.Attivo)
|
||||
.HasColumnName("attivo")
|
||||
.HasDefaultValueSql("((1))");
|
||||
|
||||
entity.Property(e => e.AuthKey)
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
.HasColumnName("authKey")
|
||||
.HasDefaultValueSql("('##########')");
|
||||
|
||||
entity.Property(e => e.Cf)
|
||||
.IsRequired()
|
||||
.HasMaxLength(16)
|
||||
.HasColumnName("CF")
|
||||
.HasDefaultValueSql("('0000000000000000')");
|
||||
|
||||
entity.Property(e => e.CodDipendenteExt)
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
.HasColumnName("codDipendenteExt")
|
||||
.HasDefaultValueSql("('')")
|
||||
.HasComment("nome/codice dipendente per sistema esterno da importare");
|
||||
|
||||
entity.Property(e => e.CodHw)
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
.HasColumnName("codHw")
|
||||
.HasDefaultValueSql("('')");
|
||||
|
||||
entity.Property(e => e.CodOrario)
|
||||
.HasMaxLength(50)
|
||||
.HasColumnName("codOrario");
|
||||
|
||||
entity.Property(e => e.Cognome).HasMaxLength(50);
|
||||
|
||||
entity.Property(e => e.DataAssunzione)
|
||||
.HasColumnType("date")
|
||||
.HasColumnName("dataAssunzione")
|
||||
.HasDefaultValueSql("('1900-01-01')");
|
||||
|
||||
entity.Property(e => e.DataCessazione)
|
||||
.HasColumnType("date")
|
||||
.HasColumnName("dataCessazione")
|
||||
.HasDefaultValueSql("('9999-12-31')");
|
||||
|
||||
entity.Property(e => e.DataNascita)
|
||||
.HasColumnType("datetime")
|
||||
.HasColumnName("dataNascita");
|
||||
|
||||
entity.Property(e => e.Dominio)
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
.HasColumnName("dominio")
|
||||
.HasDefaultValueSql("('DOMINIO')");
|
||||
|
||||
entity.Property(e => e.Email)
|
||||
.IsRequired()
|
||||
.HasMaxLength(250)
|
||||
.HasColumnName("email")
|
||||
.HasDefaultValueSql("('')");
|
||||
|
||||
entity.Property(e => e.Gruppo)
|
||||
.HasMaxLength(50)
|
||||
.HasColumnName("gruppo")
|
||||
.HasDefaultValueSql("('NA')");
|
||||
|
||||
entity.Property(e => e.LuogoNascita)
|
||||
.HasMaxLength(50)
|
||||
.HasColumnName("luogoNascita");
|
||||
|
||||
entity.Property(e => e.MailDay)
|
||||
.HasColumnName("mailDay")
|
||||
.HasDefaultValueSql("((0))");
|
||||
|
||||
entity.Property(e => e.MailLastOp)
|
||||
.HasColumnName("mailLastOp")
|
||||
.HasDefaultValueSql("((0))");
|
||||
|
||||
entity.Property(e => e.MailMonth)
|
||||
.HasColumnName("mailMonth")
|
||||
.HasDefaultValueSql("((0))");
|
||||
|
||||
entity.Property(e => e.MailWeek)
|
||||
.HasColumnName("mailWeek")
|
||||
.HasDefaultValueSql("((0))");
|
||||
|
||||
entity.Property(e => e.Matricola)
|
||||
.HasMaxLength(50)
|
||||
.HasColumnName("matricola");
|
||||
|
||||
entity.Property(e => e.NazNascita)
|
||||
.HasMaxLength(50)
|
||||
.HasColumnName("nazNascita");
|
||||
|
||||
entity.Property(e => e.Nome).HasMaxLength(50);
|
||||
|
||||
entity.Property(e => e.NumAuth)
|
||||
.HasColumnName("numAuth")
|
||||
.HasDefaultValueSql("((0))")
|
||||
.HasComment("numero di impieghi della authKey");
|
||||
|
||||
entity.Property(e => e.ProvNascita)
|
||||
.HasMaxLength(50)
|
||||
.HasColumnName("provNascita");
|
||||
|
||||
entity.Property(e => e.Utente)
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
.HasColumnName("utente")
|
||||
.HasDefaultValueSql("('UTENTE')");
|
||||
|
||||
entity.Property(e => e.WolMac)
|
||||
.HasMaxLength(50)
|
||||
.HasColumnName("WOL_MAC");
|
||||
|
||||
entity.HasOne(d => d.CodOrarioNavigation)
|
||||
.WithMany(p => p.Dipendentis)
|
||||
.HasForeignKey(d => d.CodOrario)
|
||||
.HasConstraintName("FK_Dipendenti_AnagOrari");
|
||||
|
||||
entity.HasOne(d => d.GruppoNavigation)
|
||||
.WithMany(p => p.Dipendentis)
|
||||
.HasForeignKey(d => d.Gruppo)
|
||||
.HasConstraintName("FK_Dipendenti_AnagGruppi");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<Timbrature>(entity =>
|
||||
{
|
||||
entity.HasKey(e => new { e.IdxDipendente, e.DataOra });
|
||||
|
||||
entity.ToTable("Timbrature");
|
||||
|
||||
entity.HasIndex(e => new { e.IdxDipendente, e.Entrata }, "ix_Timbrature_IdxDip_Entrata");
|
||||
|
||||
entity.Property(e => e.IdxDipendente).HasColumnName("idxDipendente");
|
||||
|
||||
entity.Property(e => e.DataOra)
|
||||
.HasColumnType("datetime")
|
||||
.HasColumnName("dataOra");
|
||||
|
||||
entity.Property(e => e.Approv)
|
||||
.HasDefaultValueSql("((0))")
|
||||
.HasComment("Approvazioen timbratura (default true...)");
|
||||
|
||||
entity.Property(e => e.CodTipoTimb)
|
||||
.HasMaxLength(10)
|
||||
.HasDefaultValueSql("(N'BC')");
|
||||
|
||||
entity.Property(e => e.Entrata).HasColumnName("entrata");
|
||||
|
||||
entity.Property(e => e.Ipv4)
|
||||
.HasMaxLength(15)
|
||||
.HasColumnName("IPv4")
|
||||
.HasDefaultValueSql("(N'0.0.0.0')");
|
||||
|
||||
entity.HasOne(d => d.CodTipoTimbNavigation)
|
||||
.WithMany(p => p.Timbratures)
|
||||
.HasForeignKey(d => d.CodTipoTimb)
|
||||
.HasConstraintName("FK_Timbrature_AnagTipoTimb");
|
||||
|
||||
entity.HasOne(d => d.IdxDipendenteNavigation)
|
||||
.WithMany(p => p.Timbratures)
|
||||
.HasForeignKey(d => d.IdxDipendente)
|
||||
.OnDelete(DeleteBehavior.ClientSetNull)
|
||||
.HasConstraintName("FK_Timbrature_Dipendenti");
|
||||
});
|
||||
|
||||
OnModelCreatingPartial(modelBuilder);
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Public Methods
|
||||
|
||||
public void DbForceMigrate()
|
||||
{
|
||||
try
|
||||
{
|
||||
// se non ci fosse... crea o migra!
|
||||
Database.Migrate();
|
||||
Log.Info("DbForceMigrate: done!");
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Error(exc, "DbForceMigrate: Exception during context initialization 01");
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user