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.
213 lines
8.3 KiB
213 lines
8.3 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<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<OrigineDemandeFormation> OrigineDemandeFormation { get; set; }
|
|
public DbSet<OrigineFormation> OrigineFormation { get; set; }
|
|
public DbSet<ParticipationFormation> ParticipationFormation { get; set; }
|
|
public DbSet<StatutFormation> StatutFormation { get; set; }
|
|
public DbSet<Theme> Theme { 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.Delegation).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<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.Id);
|
|
entity.Property(e => e.Id).ValueGeneratedOnAdd();
|
|
});
|
|
|
|
modelBuilder.Entity<Formation>(entity =>
|
|
{
|
|
entity.HasKey(e => e.Id);
|
|
entity.Property(e => e.Id).ValueGeneratedOnAdd();
|
|
});
|
|
|
|
modelBuilder.Entity<ModeFormation>(entity =>
|
|
{
|
|
entity.HasKey(e => e.Id);
|
|
entity.Property(e => e.Id).ValueGeneratedOnAdd();
|
|
entity.HasIndex(e => e.Libelle).IsUnique();
|
|
});
|
|
|
|
modelBuilder.Entity<OrigineDemandeFormation>(entity =>
|
|
{
|
|
entity.HasKey(e => e.Id);
|
|
entity.Property(e => e.Id).ValueGeneratedOnAdd();
|
|
entity.HasIndex(e => e.Libelle).IsUnique();
|
|
});
|
|
|
|
modelBuilder.Entity<OrigineFormation>(entity =>
|
|
{
|
|
entity.HasKey(e => e.Id);
|
|
entity.Property(e => e.Id).ValueGeneratedOnAdd();
|
|
entity.HasIndex(e => e.Libelle).IsUnique();
|
|
});
|
|
|
|
modelBuilder.Entity<ParticipationFormation>(entity =>
|
|
{
|
|
entity.HasKey(e => e.Id);
|
|
entity.Property(e => e.Id).ValueGeneratedOnAdd();
|
|
entity.HasMany<Saisie>(e => e.Evaluation).WithOne(e => e.ParticipationFormation);
|
|
});
|
|
|
|
modelBuilder.Entity<StatutFormation>(entity =>
|
|
{
|
|
entity.HasKey(e => e.Id);
|
|
entity.Property(e => e.Id).ValueGeneratedOnAdd();
|
|
entity.HasIndex(e => e.Libelle).IsUnique();
|
|
});
|
|
|
|
modelBuilder.Entity<Theme>(entity =>
|
|
{
|
|
entity.HasKey(e => e.Id);
|
|
entity.Property(e => e.Id).ValueGeneratedOnAdd();
|
|
entity.HasIndex(e => e.Libelle).IsUnique();
|
|
});
|
|
|
|
modelBuilder.Entity<TypeFormation>(entity =>
|
|
{
|
|
entity.HasKey(e => e.Id);
|
|
entity.Property(e => e.Id).ValueGeneratedOnAdd();
|
|
entity.HasIndex(e => e.Libelle).IsUnique();
|
|
});
|
|
|
|
//Notes
|
|
modelBuilder.Entity<Note>(entity =>
|
|
{
|
|
entity.HasKey(e => e.Id);
|
|
entity.Property(e => e.Id).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();
|
|
});
|
|
}
|
|
}
|
|
}
|
|
|