Ajout des annotations primary key et table dans les entités

pull/9/head
Clement FERRERE 3 years ago
parent ebe71c645a
commit 7c71bba88c
  1. 6
      Collaborateur_Epa_Back/espacecollab.backend.infrastructure.sql.dtos/AgenceSqlDto.cs
  2. 6
      Collaborateur_Epa_Back/espacecollab.backend.infrastructure.sql.dtos/BusinessUnitSqlDto.cs
  3. 2
      Collaborateur_Epa_Back/espacecollab.backend.infrastructure.sql.dtos/CollaborateurSqlDto.cs
  4. 6
      Collaborateur_Epa_Back/espacecollab.backend.infrastructure.sql.dtos/FonctionSqlDto.cs
  5. 4
      Collaborateur_Epa_Back/espacecollab.backend.infrastructure.sql.dtos/PeriodeEssaiSqlDto.cs
  6. 6
      Collaborateur_Epa_Back/espacecollab.backend.infrastructure.sql.dtos/ProjetSqlDto.cs
  7. 6
      Collaborateur_Epa_Back/espacecollab.backend.infrastructure.sql.dtos/ReferencementSqlDto.cs
  8. 6
      Collaborateur_Epa_Back/espacecollab.backend.infrastructure.sql.dtos/SiteSqlDto.cs
  9. 4
      Collaborateur_Epa_Back/espacecollab.backend.infrastructure.sql.dtos/TechnologieSqlDto.cs
  10. 2
      Collaborateur_Epa_Back/espacecollab.backend.infrastructure.sql/MainDbContext.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; using espacecollab.backend.infrastructure.sql.dtos.Interfaces;
namespace espacecollab.backend.infrastructure.sql.dtos; namespace espacecollab.backend.infrastructure.sql.dtos;
[Table("agence")]
public class AgenceSqlDto : IGenericIdSqlDto public class AgenceSqlDto : IGenericIdSqlDto
{ {
[Key]
public int Id { get; set; } public int Id { get; set; }
public string Name { get; set; } public string Name { get; set; }

@ -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; using espacecollab.backend.infrastructure.sql.dtos.Interfaces;
namespace espacecollab.backend.infrastructure.sql.dtos; namespace espacecollab.backend.infrastructure.sql.dtos;
[Table("businessunit")]
public class BusinessUnitSqlDto : IGenericIdSqlDto public class BusinessUnitSqlDto : IGenericIdSqlDto
{ {
[Key]
public int Id { get; set; } public int Id { get; set; }
public string Name { get; set; } public string Name { get; set; }
public int AgenceId { get; set; } public int AgenceId { get; set; }

@ -2,9 +2,11 @@
using System.Diagnostics.CodeAnalysis; using System.Diagnostics.CodeAnalysis;
using espacecollab.backend.infrastructure.sql.dtos.Interfaces; using espacecollab.backend.infrastructure.sql.dtos.Interfaces;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace espacecollab.backend.infrastructure.sql.dtos; namespace espacecollab.backend.infrastructure.sql.dtos;
[Table("collaborateur")]
public class CollaborateurSqlDto : IGenericIdSqlDto public class CollaborateurSqlDto : IGenericIdSqlDto
{ {
[Key] [Key]

@ -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; using espacecollab.backend.infrastructure.sql.dtos.Interfaces;
namespace espacecollab.backend.infrastructure.sql.dtos namespace espacecollab.backend.infrastructure.sql.dtos
{ {
[Table("fonction")]
public class FonctionSqlDto : IGenericIdSqlDto public class FonctionSqlDto : IGenericIdSqlDto
{ {
[Key]
public int Id { get; set; } public int Id { get; set; }
public string Intitule { get; set; } public string Intitule { get; set; }

@ -1,11 +1,15 @@
using espacecollab.backend.infrastructure.sql.dtos.Values; using espacecollab.backend.infrastructure.sql.dtos.Values;
using System.Diagnostics.CodeAnalysis; using System.Diagnostics.CodeAnalysis;
using espacecollab.backend.infrastructure.sql.dtos.Interfaces; using espacecollab.backend.infrastructure.sql.dtos.Interfaces;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace espacecollab.backend.infrastructure.sql.dtos; namespace espacecollab.backend.infrastructure.sql.dtos;
[Table("periodeessai")]
public class PeriodeEssaiSqlDto : IGenericIdSqlDto public class PeriodeEssaiSqlDto : IGenericIdSqlDto
{ {
[Key]
public int Id { get; set; } public int Id { get; set; }
public DateTime StartingDate { get; set; } public DateTime StartingDate { get; set; }
public DateTime PlannedEndingDate { get; set; } public DateTime PlannedEndingDate { get; set; }

@ -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; using espacecollab.backend.infrastructure.sql.dtos.Interfaces;
namespace espacecollab.backend.infrastructure.sql.dtos; namespace espacecollab.backend.infrastructure.sql.dtos;
[Table("projet")]
public class ProjetSqlDto : IGenericIdSqlDto public class ProjetSqlDto : IGenericIdSqlDto
{ {
[Key]
public int Id { get; set; } public int Id { get; set; }
public string Name { get; set; } public string Name { get; set; }
public string Client { get; set; } public string Client { get; set; }

@ -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; using espacecollab.backend.infrastructure.sql.dtos.Interfaces;
namespace espacecollab.backend.infrastructure.sql.dtos; namespace espacecollab.backend.infrastructure.sql.dtos;
[Table("referencement")]
public class ReferencementSqlDto : IGenericIdSqlDto public class ReferencementSqlDto : IGenericIdSqlDto
{ {
[Key]
public int Id { get; set; } public int Id { get; set; }
public DateTime StartingDate { get; set; } public DateTime StartingDate { get; set; }
public DateTime EndingDate { get; set; } public DateTime EndingDate { get; set; }

@ -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; using espacecollab.backend.infrastructure.sql.dtos.Interfaces;
namespace espacecollab.backend.infrastructure.sql.dtos; namespace espacecollab.backend.infrastructure.sql.dtos;
[Table("site")]
public class SiteSqlDto : IGenericIdSqlDto public class SiteSqlDto : IGenericIdSqlDto
{ {
[Key]
public int Id { get; set; } public int Id { get; set; }
public string Name { get; set; } public string Name { get; set; }
public string Address { get; set; } public string Address { get; set; }

@ -1,10 +1,14 @@
using espacecollab.backend.infrastructure.sql.dtos.Interfaces; using espacecollab.backend.infrastructure.sql.dtos.Interfaces;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Diagnostics.CodeAnalysis; using System.Diagnostics.CodeAnalysis;
namespace espacecollab.backend.infrastructure.sql.dtos; namespace espacecollab.backend.infrastructure.sql.dtos;
[Table("technologie")]
public class TechnologieSqlDto : IGenericIdSqlDto public class TechnologieSqlDto : IGenericIdSqlDto
{ {
[Key]
public int Id { get; set; } public int Id { get; set; }
public string Name { get; set; } public string Name { get; set; }

@ -28,12 +28,10 @@ public class MainDbContext : DbContext
modelBuilder.Entity<FonctionSqlDto>().Property(p => p.Id).UseMySqlIdentityColumn(); modelBuilder.Entity<FonctionSqlDto>().Property(p => p.Id).UseMySqlIdentityColumn();
modelBuilder.Entity<TechnologieSqlDto>().Property(p => p.Id).UseMySqlIdentityColumn(); modelBuilder.Entity<TechnologieSqlDto>().Property(p => p.Id).UseMySqlIdentityColumn();
modelBuilder.Entity<CollaborateurSqlDto>().Property(p => p.Id).UseMySqlIdentityColumn(); modelBuilder.Entity<CollaborateurSqlDto>().Property(p => p.Id).UseMySqlIdentityColumn();
modelBuilder modelBuilder
.Entity<CollaborateurSqlDto>() .Entity<CollaborateurSqlDto>()
.Property(e => e.Gender) .Property(e => e.Gender)
.HasConversion<string>(); .HasConversion<string>();
modelBuilder modelBuilder
.Entity<CollaborateurSqlDto>() .Entity<CollaborateurSqlDto>()
.Property(e => e.Status) .Property(e => e.Status)

Loading…
Cancel
Save