You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
232 lines
9.1 KiB
232 lines
9.1 KiB
using EPAServeur.Models.EP;
|
|
using EPAServeur.Models.Formation;
|
|
using EPAServeur.Models.Notes;
|
|
using EPAServeur.Models.SaisieChamp;
|
|
using Microsoft.EntityFrameworkCore;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace EPAServeur.Context
|
|
{
|
|
public class EpContext : DbContext
|
|
{
|
|
public EpContext(DbContextOptions options): base(options)
|
|
{
|
|
}
|
|
|
|
//EP
|
|
public DbSet<AugmentationSalaire> AugmentationSalaire { get; set; }
|
|
public DbSet<ChoixTypeEntretien> ChoixTypeEntretien { get; set; }
|
|
public DbSet<DemandeDelegation> DemandeDelegation { get; set; }
|
|
public DbSet<Document> Document { get; set; }
|
|
public DbSet<Engagement> Engagement { get; set; }
|
|
public DbSet<Ep> Ep { get; set; }
|
|
public DbSet<Objectif> Objectif { get; set; }
|
|
public DbSet<ObjectifPrecedent> ObjectifPrecedent { get; set; }
|
|
public DbSet<RdvEntretien> RdvEntretien { get; set; }
|
|
public DbSet<ReferentEP> ReferentEP { get; set; }
|
|
|
|
public DbSet<TypeEntretien> TypeEntretien { get; set; }
|
|
|
|
//Formation
|
|
public DbSet<DemandeFormation> DemandeFormation { get; set; }
|
|
public DbSet<Formation> Formation { get; set; }
|
|
public DbSet<ModeFormation> ModeFormation { get; set; }
|
|
public DbSet<OrigineDemande> OrigineDemandeFormation { get; set; }
|
|
public DbSet<OrigineFormation> OrigineFormation { get; set; }
|
|
public DbSet<ParticipationFormation> ParticipationFormation { get; set; }
|
|
public DbSet<StatutFormation> StatutFormation { get; set; }
|
|
public DbSet<TypeFormation> TypeFormation { get; set; }
|
|
|
|
//Note
|
|
public DbSet<Note> Note { get; set; }
|
|
|
|
//SaisieChamp
|
|
public DbSet<Champ> Champ { get; set; }
|
|
public DbSet<Saisie> Saisie { get; set; }
|
|
|
|
|
|
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
|
{
|
|
base.OnModelCreating(modelBuilder);
|
|
//EP
|
|
modelBuilder.Entity<AugmentationSalaire>(entity =>
|
|
{
|
|
entity.HasKey(e => e.IdAugmentationSalaire);
|
|
entity.Property(e => e.IdAugmentationSalaire).ValueGeneratedOnAdd();
|
|
});
|
|
|
|
modelBuilder.Entity<Document>(entity =>
|
|
{
|
|
entity.HasKey(e => e.IdDocument);
|
|
entity.Property(e => e.IdDocument).ValueGeneratedOnAdd();
|
|
entity.HasMany<Saisie>(e => e.Saisies).WithOne(e => e.Document);
|
|
|
|
});
|
|
|
|
modelBuilder.Entity<Engagement>(entity =>
|
|
{
|
|
entity.HasKey(e => e.IdEngagement);
|
|
entity.Property(e => e.IdEngagement).ValueGeneratedOnAdd();
|
|
});
|
|
|
|
modelBuilder.Entity<Ep>(entity =>
|
|
{
|
|
entity.HasKey(e => e.IdEP);
|
|
entity.HasOne<AugmentationSalaire>(e => e.AugmentationSalaire).WithOne(a => a.Ep).HasForeignKey<AugmentationSalaire>(a => a.IdEP);
|
|
entity.HasMany<ChoixTypeEntretien>(e => e.ChoixTypeEntretien).WithOne(c => c.Ep);
|
|
entity.HasOne<DemandeDelegation>(e => e.DemandeDelegation).WithOne(d => d.Ep).HasForeignKey<DemandeDelegation>(d => d.IdEP);
|
|
entity.HasMany<DemandeFormation>(e => e.DemandesFormation).WithOne(d => d.Ep);
|
|
entity.HasMany<CommentaireAssistant>(e => e.CommentairesAssistant).WithOne(c => c.Ep);
|
|
entity.HasMany<Document>(e => e.Documents).WithOne(d => d.Ep);
|
|
entity.HasMany<Engagement>(e => e.Engagements).WithOne(e => e.Ep);
|
|
entity.HasMany<Objectif>(e => e.Objectifs).WithOne(o => o.Ep);
|
|
entity.HasMany<ObjectifPrecedent>(e => e.ObjectifsPrecedents).WithOne(o => o.Ep);
|
|
entity.HasMany<ParticipationEP>(e => e.Participants).WithOne(p => p.Ep);
|
|
entity.HasOne<RdvEntretien>(e => e.RdvEntretien).WithOne(r => r.EpChoixRDV).HasForeignKey<RdvEntretien>(r => r.IdEPChoixRDV);
|
|
entity.HasMany<RdvEntretien>(e => e.PropositionsRDV).WithOne(r => r.EpProposition);
|
|
entity.HasOne<DemandeEPI>(e => e.DemandeEPI).WithOne(a => a.Ep).HasForeignKey<DemandeEPI>(a => a.IdEP);
|
|
|
|
});
|
|
|
|
modelBuilder.Entity<Objectif>(entity =>
|
|
{
|
|
entity.HasKey(e => e.IdObjectif);
|
|
entity.Property(e => e.IdObjectif).ValueGeneratedOnAdd();
|
|
});
|
|
|
|
modelBuilder.Entity<ObjectifPrecedent>(entity =>
|
|
{
|
|
entity.HasKey(e => e.IdObjectif);
|
|
entity.Property(e => e.IdObjectif).ValueGeneratedOnAdd();
|
|
});
|
|
|
|
modelBuilder.Entity<RdvEntretien>(entity =>
|
|
{
|
|
entity.HasKey(e => e.IdRdvEntretien);
|
|
entity.Property(e => e.IdRdvEntretien).ValueGeneratedOnAdd();
|
|
});
|
|
|
|
modelBuilder.Entity<ReferentEP>(entity =>
|
|
{
|
|
entity.HasKey(e => e.IdCollaborateur);
|
|
});
|
|
|
|
modelBuilder.Entity<ChoixTypeEntretien>(entity =>
|
|
{
|
|
entity.HasKey(e => e.Ordre);
|
|
});
|
|
|
|
|
|
modelBuilder.Entity<DemandeDelegation>(entity =>
|
|
{
|
|
entity.HasKey(e => e.IdDemandeDelegation);
|
|
});
|
|
|
|
modelBuilder.Entity<DemandeEPI>(entity =>
|
|
{
|
|
entity.HasKey(e => e.IdDemandeEPI);
|
|
});
|
|
|
|
|
|
modelBuilder.Entity<ParticipationEP>(entity =>
|
|
{
|
|
entity.HasKey(e => e.IdParticipationEP);
|
|
});
|
|
|
|
|
|
modelBuilder.Entity<TypeEntretien>(entity =>
|
|
{
|
|
entity.HasKey(e => e.IdTypeEntretien);
|
|
entity.HasIndex(e => e.Libelle).IsUnique();
|
|
});
|
|
|
|
modelBuilder.Entity<CommentaireAssistant>(entity =>
|
|
{
|
|
entity.HasKey(e => e.IdCommentaireAssistant);
|
|
entity.Property(e => e.IdCommentaireAssistant).ValueGeneratedOnAdd();
|
|
});
|
|
|
|
//Formation
|
|
modelBuilder.Entity<DemandeFormation>(entity =>
|
|
{
|
|
entity.HasKey(e => e.IdDemandeFormation);
|
|
entity.Property(e => e.IdDemandeFormation).ValueGeneratedOnAdd();
|
|
entity.HasOne<ParticipationFormation>(e => e.ParticipationFormation).WithOne(e => e.DemandeFormation).HasForeignKey<ParticipationFormation>(d => d.IdParticipationFormation);
|
|
|
|
});
|
|
|
|
modelBuilder.Entity<Formation>(entity =>
|
|
{
|
|
entity.HasKey(e => e.IdFormation);
|
|
entity.Property(e => e.IdFormation).ValueGeneratedOnAdd();
|
|
entity.HasMany<ParticipationFormation>(e => e.ParticipationsFormation).WithOne(e => e.Formation);
|
|
});
|
|
|
|
modelBuilder.Entity<ModeFormation>(entity =>
|
|
{
|
|
entity.HasKey(e => e.IdModeFormation);
|
|
entity.Property(e => e.IdModeFormation).ValueGeneratedOnAdd();
|
|
entity.HasIndex(e => e.Libelle).IsUnique();
|
|
});
|
|
|
|
modelBuilder.Entity<OrigineDemande>(entity =>
|
|
{
|
|
entity.HasKey(e => e.IdOrigineDemande);
|
|
entity.Property(e => e.IdOrigineDemande).ValueGeneratedOnAdd();
|
|
entity.HasIndex(e => e.Libelle).IsUnique();
|
|
});
|
|
|
|
modelBuilder.Entity<OrigineFormation>(entity =>
|
|
{
|
|
entity.HasKey(e => e.IdOrigineFormation);
|
|
entity.Property(e => e.IdOrigineFormation).ValueGeneratedOnAdd();
|
|
entity.HasIndex(e => e.Libelle).IsUnique();
|
|
});
|
|
|
|
modelBuilder.Entity<ParticipationFormation>(entity =>
|
|
{
|
|
entity.HasKey(e => e.IdParticipationFormation);
|
|
entity.Property(e => e.IdParticipationFormation).ValueGeneratedOnAdd();
|
|
entity.HasMany<Saisie>(e => e.Evaluation).WithOne(e => e.ParticipationFormation);
|
|
});
|
|
|
|
modelBuilder.Entity<StatutFormation>(entity =>
|
|
{
|
|
entity.HasKey(e => e.IdStatutFormation);
|
|
entity.Property(e => e.IdStatutFormation).ValueGeneratedOnAdd();
|
|
entity.HasIndex(e => e.Libelle).IsUnique();
|
|
});
|
|
|
|
modelBuilder.Entity<TypeFormation>(entity =>
|
|
{
|
|
entity.HasKey(e => e.IdTypeFormation);
|
|
entity.Property(e => e.IdTypeFormation).ValueGeneratedOnAdd();
|
|
entity.HasIndex(e => e.Libelle).IsUnique();
|
|
});
|
|
|
|
//Notes
|
|
modelBuilder.Entity<Note>(entity =>
|
|
{
|
|
entity.HasKey(e => e.IdNote);
|
|
entity.Property(e => e.IdNote).ValueGeneratedOnAdd();
|
|
});
|
|
|
|
//SaisieChamp
|
|
modelBuilder.Entity<Champ>(entity =>
|
|
{
|
|
entity.HasKey(e => e.IdChamp);
|
|
entity.Property(e => e.IdChamp).ValueGeneratedOnAdd();
|
|
entity.HasMany<Saisie>(e => e.Saisies).WithOne(e => e.Champ);
|
|
});
|
|
|
|
modelBuilder.Entity<Saisie>(entity =>
|
|
{
|
|
entity.HasKey(e => e.IdSaisie);
|
|
entity.Property(e => e.IdSaisie).ValueGeneratedOnAdd();
|
|
});
|
|
}
|
|
}
|
|
}
|
|
|