From 7c71bba88ceb14f00009724278e888eb5ee68846 Mon Sep 17 00:00:00 2001 From: Clement FERRERE Date: Tue, 22 Feb 2022 14:20:34 +0100 Subject: [PATCH] =?UTF-8?q?Ajout=20des=20annotations=20primary=20key=20et?= =?UTF-8?q?=20table=20dans=20les=20entit=C3=A9s?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AgenceSqlDto.cs | 6 +++++- .../BusinessUnitSqlDto.cs | 6 +++++- .../CollaborateurSqlDto.cs | 2 ++ .../FonctionSqlDto.cs | 6 +++++- .../PeriodeEssaiSqlDto.cs | 4 ++++ .../ProjetSqlDto.cs | 6 +++++- .../ReferencementSqlDto.cs | 6 +++++- .../SiteSqlDto.cs | 6 +++++- .../TechnologieSqlDto.cs | 4 ++++ .../MainDbContext.cs | 2 -- 10 files changed, 40 insertions(+), 8 deletions(-) diff --git a/Collaborateur_Epa_Back/espacecollab.backend.infrastructure.sql.dtos/AgenceSqlDto.cs b/Collaborateur_Epa_Back/espacecollab.backend.infrastructure.sql.dtos/AgenceSqlDto.cs index 8680156..5059f70 100644 --- a/Collaborateur_Epa_Back/espacecollab.backend.infrastructure.sql.dtos/AgenceSqlDto.cs +++ b/Collaborateur_Epa_Back/espacecollab.backend.infrastructure.sql.dtos/AgenceSqlDto.cs @@ -1,10 +1,14 @@ -using System.Diagnostics.CodeAnalysis; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using System.Diagnostics.CodeAnalysis; using espacecollab.backend.infrastructure.sql.dtos.Interfaces; namespace espacecollab.backend.infrastructure.sql.dtos; +[Table("agence")] public class AgenceSqlDto : IGenericIdSqlDto { + [Key] public int Id { get; set; } public string Name { get; set; } diff --git a/Collaborateur_Epa_Back/espacecollab.backend.infrastructure.sql.dtos/BusinessUnitSqlDto.cs b/Collaborateur_Epa_Back/espacecollab.backend.infrastructure.sql.dtos/BusinessUnitSqlDto.cs index c311787..ce6534e 100644 --- a/Collaborateur_Epa_Back/espacecollab.backend.infrastructure.sql.dtos/BusinessUnitSqlDto.cs +++ b/Collaborateur_Epa_Back/espacecollab.backend.infrastructure.sql.dtos/BusinessUnitSqlDto.cs @@ -1,10 +1,14 @@ -using System.Diagnostics.CodeAnalysis; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using System.Diagnostics.CodeAnalysis; using espacecollab.backend.infrastructure.sql.dtos.Interfaces; namespace espacecollab.backend.infrastructure.sql.dtos; +[Table("businessunit")] public class BusinessUnitSqlDto : IGenericIdSqlDto { + [Key] public int Id { get; set; } public string Name { get; set; } public int AgenceId { get; set; } diff --git a/Collaborateur_Epa_Back/espacecollab.backend.infrastructure.sql.dtos/CollaborateurSqlDto.cs b/Collaborateur_Epa_Back/espacecollab.backend.infrastructure.sql.dtos/CollaborateurSqlDto.cs index b01751e..8803af6 100644 --- a/Collaborateur_Epa_Back/espacecollab.backend.infrastructure.sql.dtos/CollaborateurSqlDto.cs +++ b/Collaborateur_Epa_Back/espacecollab.backend.infrastructure.sql.dtos/CollaborateurSqlDto.cs @@ -2,9 +2,11 @@ using System.Diagnostics.CodeAnalysis; using espacecollab.backend.infrastructure.sql.dtos.Interfaces; using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; namespace espacecollab.backend.infrastructure.sql.dtos; +[Table("collaborateur")] public class CollaborateurSqlDto : IGenericIdSqlDto { [Key] diff --git a/Collaborateur_Epa_Back/espacecollab.backend.infrastructure.sql.dtos/FonctionSqlDto.cs b/Collaborateur_Epa_Back/espacecollab.backend.infrastructure.sql.dtos/FonctionSqlDto.cs index 0246266..b1d03db 100644 --- a/Collaborateur_Epa_Back/espacecollab.backend.infrastructure.sql.dtos/FonctionSqlDto.cs +++ b/Collaborateur_Epa_Back/espacecollab.backend.infrastructure.sql.dtos/FonctionSqlDto.cs @@ -1,10 +1,14 @@ -using System.Diagnostics.CodeAnalysis; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using System.Diagnostics.CodeAnalysis; using espacecollab.backend.infrastructure.sql.dtos.Interfaces; namespace espacecollab.backend.infrastructure.sql.dtos { + [Table("fonction")] public class FonctionSqlDto : IGenericIdSqlDto { + [Key] public int Id { get; set; } public string Intitule { get; set; } diff --git a/Collaborateur_Epa_Back/espacecollab.backend.infrastructure.sql.dtos/PeriodeEssaiSqlDto.cs b/Collaborateur_Epa_Back/espacecollab.backend.infrastructure.sql.dtos/PeriodeEssaiSqlDto.cs index 8d361de..78e8327 100644 --- a/Collaborateur_Epa_Back/espacecollab.backend.infrastructure.sql.dtos/PeriodeEssaiSqlDto.cs +++ b/Collaborateur_Epa_Back/espacecollab.backend.infrastructure.sql.dtos/PeriodeEssaiSqlDto.cs @@ -1,11 +1,15 @@ using espacecollab.backend.infrastructure.sql.dtos.Values; using System.Diagnostics.CodeAnalysis; using espacecollab.backend.infrastructure.sql.dtos.Interfaces; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; namespace espacecollab.backend.infrastructure.sql.dtos; +[Table("periodeessai")] public class PeriodeEssaiSqlDto : IGenericIdSqlDto { + [Key] public int Id { get; set; } public DateTime StartingDate { get; set; } public DateTime PlannedEndingDate { get; set; } diff --git a/Collaborateur_Epa_Back/espacecollab.backend.infrastructure.sql.dtos/ProjetSqlDto.cs b/Collaborateur_Epa_Back/espacecollab.backend.infrastructure.sql.dtos/ProjetSqlDto.cs index 9cd830b..fc1198b 100644 --- a/Collaborateur_Epa_Back/espacecollab.backend.infrastructure.sql.dtos/ProjetSqlDto.cs +++ b/Collaborateur_Epa_Back/espacecollab.backend.infrastructure.sql.dtos/ProjetSqlDto.cs @@ -1,10 +1,14 @@ -using System.Diagnostics.CodeAnalysis; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using System.Diagnostics.CodeAnalysis; using espacecollab.backend.infrastructure.sql.dtos.Interfaces; namespace espacecollab.backend.infrastructure.sql.dtos; +[Table("projet")] public class ProjetSqlDto : IGenericIdSqlDto { + [Key] public int Id { get; set; } public string Name { get; set; } public string Client { get; set; } diff --git a/Collaborateur_Epa_Back/espacecollab.backend.infrastructure.sql.dtos/ReferencementSqlDto.cs b/Collaborateur_Epa_Back/espacecollab.backend.infrastructure.sql.dtos/ReferencementSqlDto.cs index 09318a5..11dd489 100644 --- a/Collaborateur_Epa_Back/espacecollab.backend.infrastructure.sql.dtos/ReferencementSqlDto.cs +++ b/Collaborateur_Epa_Back/espacecollab.backend.infrastructure.sql.dtos/ReferencementSqlDto.cs @@ -1,10 +1,14 @@ -using System.Diagnostics.CodeAnalysis; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using System.Diagnostics.CodeAnalysis; using espacecollab.backend.infrastructure.sql.dtos.Interfaces; namespace espacecollab.backend.infrastructure.sql.dtos; +[Table("referencement")] public class ReferencementSqlDto : IGenericIdSqlDto { + [Key] public int Id { get; set; } public DateTime StartingDate { get; set; } public DateTime EndingDate { get; set; } diff --git a/Collaborateur_Epa_Back/espacecollab.backend.infrastructure.sql.dtos/SiteSqlDto.cs b/Collaborateur_Epa_Back/espacecollab.backend.infrastructure.sql.dtos/SiteSqlDto.cs index f639708..6a7faa4 100644 --- a/Collaborateur_Epa_Back/espacecollab.backend.infrastructure.sql.dtos/SiteSqlDto.cs +++ b/Collaborateur_Epa_Back/espacecollab.backend.infrastructure.sql.dtos/SiteSqlDto.cs @@ -1,10 +1,14 @@ -using System.Diagnostics.CodeAnalysis; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using System.Diagnostics.CodeAnalysis; using espacecollab.backend.infrastructure.sql.dtos.Interfaces; namespace espacecollab.backend.infrastructure.sql.dtos; +[Table("site")] public class SiteSqlDto : IGenericIdSqlDto { + [Key] public int Id { get; set; } public string Name { get; set; } public string Address { get; set; } diff --git a/Collaborateur_Epa_Back/espacecollab.backend.infrastructure.sql.dtos/TechnologieSqlDto.cs b/Collaborateur_Epa_Back/espacecollab.backend.infrastructure.sql.dtos/TechnologieSqlDto.cs index 01df2e0..3654135 100644 --- a/Collaborateur_Epa_Back/espacecollab.backend.infrastructure.sql.dtos/TechnologieSqlDto.cs +++ b/Collaborateur_Epa_Back/espacecollab.backend.infrastructure.sql.dtos/TechnologieSqlDto.cs @@ -1,10 +1,14 @@ using espacecollab.backend.infrastructure.sql.dtos.Interfaces; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; using System.Diagnostics.CodeAnalysis; namespace espacecollab.backend.infrastructure.sql.dtos; +[Table("technologie")] public class TechnologieSqlDto : IGenericIdSqlDto { + [Key] public int Id { get; set; } public string Name { get; set; } diff --git a/Collaborateur_Epa_Back/espacecollab.backend.infrastructure.sql/MainDbContext.cs b/Collaborateur_Epa_Back/espacecollab.backend.infrastructure.sql/MainDbContext.cs index b5a1163..1f7f0bd 100644 --- a/Collaborateur_Epa_Back/espacecollab.backend.infrastructure.sql/MainDbContext.cs +++ b/Collaborateur_Epa_Back/espacecollab.backend.infrastructure.sql/MainDbContext.cs @@ -28,12 +28,10 @@ public class MainDbContext : DbContext modelBuilder.Entity().Property(p => p.Id).UseMySqlIdentityColumn(); modelBuilder.Entity().Property(p => p.Id).UseMySqlIdentityColumn(); modelBuilder.Entity().Property(p => p.Id).UseMySqlIdentityColumn(); - modelBuilder .Entity() .Property(e => e.Gender) .HasConversion(); - modelBuilder .Entity() .Property(e => e.Status)