Bonjour,
Je rencontre un soucis dans le mapping des mes classes.
Voici les classes concernées :
Code C# : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5 public abstract class Parametre public abstract class ParametreApplication : Parametre public abstract class ParametreUtilisateur : Parametre public class ParametreUtilisateurEntier : ParametreUtilisateur public class ParametreApplicationChaine : ParametreApplication
L'idée, c'est de mapper toutes ces classes à une seule et même table en base, à savoir la table Parametre.
Pour cela, j'ai indiqué ceci :
Mais j'ai une erreur :
Code C# : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13 modelBuilder.Entity<ParametreApplicationEntier>() .Map(m => { m.MapInheritedProperties(); m.ToTable("Parametre"); }); modelBuilder.Entity<ParametreUtilisateurChaine>() .Map(m => { m.MapInheritedProperties(); m.ToTable("Parametre"); });
The entity types 'ParametreApplicationEntier' and 'ParametreUtilisateurChaine' cannot share table 'Parametre' because they are not in the same type hierarchy or do not have a valid one to one foreign key relationship with matching primary keys between them.
Je commence à sécher, si vous pouviez m'apporter votre aide. Merci !
Partager