diff --git a/GPW.CORE.Data/DbModels/CheckVc19Model.cs b/GPW.CORE.Data/DbModels/CheckVc19Model.cs index b9c7243..f3bd3eb 100644 --- a/GPW.CORE.Data/DbModels/CheckVc19Model.cs +++ b/GPW.CORE.Data/DbModels/CheckVc19Model.cs @@ -24,6 +24,6 @@ namespace GPW.CORE.Data.DbModels /// Navigation property to Dipendente /// [ForeignKey("IdxDipendente")] - public virtual Dipendenti? DipNav { get; set; } + public virtual DipendentiModel? DipNav { get; set; } } } diff --git a/GPW.CORE.Data/DbModels/Dipendenti.cs b/GPW.CORE.Data/DbModels/DipendentiModel.cs similarity index 67% rename from GPW.CORE.Data/DbModels/Dipendenti.cs rename to GPW.CORE.Data/DbModels/DipendentiModel.cs index 01533af..fe15bd5 100644 --- a/GPW.CORE.Data/DbModels/Dipendenti.cs +++ b/GPW.CORE.Data/DbModels/DipendentiModel.cs @@ -1,17 +1,24 @@ using System; using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; namespace GPW.CORE.Data.DbModels { - public partial class Dipendenti + // + // This is here so CodeMaid doesn't reorganize this document + // + [Table("Dipendenti")] + public partial class DipendentiModel { - public Dipendenti() + public DipendentiModel() { - RegAttivita = new HashSet(); - RilievoTemps = new HashSet(); - Timbratures = new HashSet(); + RegAttivitaNav = new HashSet(); + RilievoTempNav = new HashSet(); + TimbratureNav = new HashSet(); } + [Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)] public int IdxDipendente { get; set; } public string? Matricola { get; set; } public string Cf { get; set; } = null!; @@ -45,8 +52,8 @@ namespace GPW.CORE.Data.DbModels public DateTime? DataCessazione { get; set; } public bool? Attivo { get; set; } - public virtual ICollection RegAttivita { get; set; } - public virtual ICollection RilievoTemps { get; set; } - public virtual ICollection Timbratures { get; set; } + public virtual ICollection RegAttivitaNav { get; set; } + public virtual ICollection RilievoTempNav { get; set; } + public virtual ICollection TimbratureNav { get; set; } } } diff --git a/GPW.CORE.Data/DbModels/RegAttivitum.cs b/GPW.CORE.Data/DbModels/RegAttivitum.cs index bc0199d..51562a4 100644 --- a/GPW.CORE.Data/DbModels/RegAttivitum.cs +++ b/GPW.CORE.Data/DbModels/RegAttivitum.cs @@ -17,6 +17,6 @@ namespace GPW.CORE.Data.DbModels public decimal? OreTot { get; set; } public decimal? Importo { get; set; } - public virtual Dipendenti IdxDipendenteNavigation { get; set; } = null!; + public virtual DipendentiModel IdxDipendenteNavigation { get; set; } = null!; } } diff --git a/GPW.CORE.Data/DbModels/RilievoTemp.cs b/GPW.CORE.Data/DbModels/RilievoTemp.cs index fbf4d93..a243754 100644 --- a/GPW.CORE.Data/DbModels/RilievoTemp.cs +++ b/GPW.CORE.Data/DbModels/RilievoTemp.cs @@ -9,6 +9,6 @@ namespace GPW.CORE.Data.DbModels public DateTime DtRilievo { get; set; } public decimal TempRil { get; set; } - public virtual Dipendenti IdxDipendenteNavigation { get; set; } = null!; + public virtual DipendentiModel IdxDipendenteNavigation { get; set; } = null!; } } diff --git a/GPW.CORE.Data/DbModels/Timbrature.cs b/GPW.CORE.Data/DbModels/Timbrature.cs index b326369..c2aabd9 100644 --- a/GPW.CORE.Data/DbModels/Timbrature.cs +++ b/GPW.CORE.Data/DbModels/Timbrature.cs @@ -15,6 +15,6 @@ namespace GPW.CORE.Data.DbModels /// public bool? Approv { get; set; } - public virtual Dipendenti IdxDipendenteNavigation { get; set; } = null!; + public virtual DipendentiModel IdxDipendenteNavigation { get; set; } = null!; } } diff --git a/GPW.CORE.Data/GPWContext.cs b/GPW.CORE.Data/GPWContext.cs index 912d1cf..d5051a2 100644 --- a/GPW.CORE.Data/GPWContext.cs +++ b/GPW.CORE.Data/GPWContext.cs @@ -1,11 +1,12 @@ using System; using System.Collections.Generic; +using GPW.CORE.Data.DbModels; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.Extensions.Configuration; using NLog; -namespace GPW.CORE.Data.DbModels +namespace GPW.CORE.Data { public partial class GPWContext : DbContext { @@ -36,8 +37,8 @@ namespace GPW.CORE.Data.DbModels } } - public virtual DbSet DbSetCheckVc19 { get; set; } = null!; - public virtual DbSet DbSetDipendenti { get; set; } = null!; + public virtual DbSet DbSetCheckVc19 { get; set; } = null!; + public virtual DbSet DbSetDipendenti { get; set; } = null!; public virtual DbSet DbSetRegAttivita { get; set; } = null!; public virtual DbSet DbSetRilievoTemp { get; set; } = null!; public virtual DbSet DbSetTimbrature { get; set; } = null!; @@ -77,13 +78,8 @@ namespace GPW.CORE.Data.DbModels { modelBuilder.UseCollation("Latin1_General_CI_AS"); - modelBuilder.Entity(entity => + modelBuilder.Entity(entity => { - entity.HasKey(e => e.IdxCheckVc19) - .HasName("PK_CheckC19"); - - entity.ToTable("CheckVC19"); - entity.Property(e => e.Cognome) .HasMaxLength(100) .HasColumnName("cognome") @@ -112,11 +108,8 @@ namespace GPW.CORE.Data.DbModels .HasDefaultValueSql("('')"); }); - modelBuilder.Entity(entity => + modelBuilder.Entity(entity => { - entity.HasKey(e => e.IdxDipendente); - - entity.ToTable("Dipendenti"); entity.Property(e => e.IdxDipendente).HasColumnName("idxDipendente"); @@ -272,7 +265,7 @@ namespace GPW.CORE.Data.DbModels .HasComment("Ore Attività - prima era ([dbo].[f_hourInterval]([inizio],[fine])) poi sostituita per performance"); entity.HasOne(d => d.IdxDipendenteNavigation) - .WithMany(p => p.RegAttivita) + .WithMany(p => p.RegAttivitaNav) .HasForeignKey(d => d.IdxDipendente) .OnDelete(DeleteBehavior.ClientSetNull) .HasConstraintName("FK_RegAttivita_Dipendenti"); @@ -295,7 +288,7 @@ namespace GPW.CORE.Data.DbModels .HasColumnName("tempRil"); entity.HasOne(d => d.IdxDipendenteNavigation) - .WithMany(p => p.RilievoTemps) + .WithMany(p => p.RilievoTempNav) .HasForeignKey(d => d.IdxDipendente) .OnDelete(DeleteBehavior.ClientSetNull) .HasConstraintName("FK_RilievoTemp_Dipendenti"); @@ -331,7 +324,7 @@ namespace GPW.CORE.Data.DbModels .HasDefaultValueSql("(N'0.0.0.0')"); entity.HasOne(d => d.IdxDipendenteNavigation) - .WithMany(p => p.Timbratures) + .WithMany(p => p.TimbratureNav) .HasForeignKey(d => d.IdxDipendente) .OnDelete(DeleteBehavior.ClientSetNull) .HasConstraintName("FK_Timbrature_Dipendenti");